> ------------------------------------------------------------------------------ See main.inc.php for release information --------------------------------------------------------------------------- */ if(!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCRequestBuilder.class.inc.php'); load_language('plugin.lang', ASE_PATH); class RBCallBackASEDate extends GPCSearchCallback { /** * the getImageId returns the name of the image id attribute * return String */ static public function getImageId() { return("ase_pitd.id"); } /** * the getSelect function must return an attribute list separated with a comma * * "att1, att2, att3, att4" */ static public function getSelect($param="") { if($param['dateType']=='c') { return(" ase_pitd.date_creation AS dateCreation"); } else { return(" ase_pitd.date_available AS dateAvailable"); } } /** * the getFrom function must return a tables list separated with a comma * * "table1, (table2 left join table3 on table2.key = table3.key), table4" */ static public function getFrom($param="") { global $prefixeTable; return(IMAGES_TABLE." ase_pitd "); } /** * the getWhere function must return a ready to use where clause * * "(att1 = value0 OR att2 = value1) AND att4 LIKE value2 " */ static public function getWhere($param="") { global $user; if($param['dateType']=='c') { $returned=" ase_pitd.date_creation "; } else { $returned=" ase_pitd.date_available "; } switch($param['searchType']) { case 'eq': $returned.=" = '".$param['from']."' "; break; case 'bt': $returned.=" BETWEEN '".$param['from']."' AND '".$param['to']."' "; break; case 'gt': $returned.=" >= '".$param['from']."' "; break; case 'lt': $returned.=" <= '".$param['to']."' "; break; } return($returned); } /** * the getJoin function must return a ready to use where allowing to join the * IMAGES table (key : id) with given conditions * * "att3 = pit.id " */ static public function getJoin($param="") { return("ase_pitd.id = pit.id"); } /** * the getFilter function must return a ready to use where clause * this where clause is used to filter the cache when the used tables can * return more than one result * * the filter can be empty, can be equal to the where clause, or can be equal * to a sub part of the where clause * */ static public function getFilter($param="") { return(""); } /** * this function is called by the request builder, allowing to display plugin * data with a specific format * * @param Array $attributes : array of ('attribute_name' => 'attribute_value') * @return String : HTML formatted value */ static public function formatData($attributes) { /* attributes is an array : * Array( * 'csColors' => 'color1,color2,color3,...,colorN', * 'csColorsPct' => 'pct1,pct2,pct3,...,pctN' * ); */ $returned=""; if(array_key_exists('dateCreation', $attributes)) { $returned.=l10n('ase_dateCreation')." : ".$attributes['dateCreation']; } else { $returned.=l10n('ase_Available')." : ".$attributes['dateAvailable']; } return($returned); } /** * this function is called by the request builder to make the search page, and * must return the HTML & JS code of the dialogbox used to select criterion * * Notes : * - the dialogbox is a JS object with a public method 'show' * - when the method show is called, one parameter is given by the request * builder ; the parameter is an object defined as this : * { * cBuilder: an instance of the criteriaBuilder object used in the page, * eventOK : a callback function, called when the OK button is pushed * id: * } * * * * * @param String $mode : can take 'admin' or 'public' values, allowing to * return different interface if needed * @return String : HTML formatted value */ static public function getInterfaceContent($mode='admin') { return(ASE_functions::dialogBoxASEDate()); } /** * this function returns the label displayed in the criterion menu * * @return String : label displayed in the criterions menu */ static public function getInterfaceLabel() { return(l10n('ase_add_date')); } /** * this function returns the name of the dialog box class * * @return String : name of the dialogbox class */ static public function getInterfaceDBClass() { return('dialogChooseASEDateBox'); } } ?>