Changeset 18
- Timestamp:
- 09/04/07 20:27:23 (16 months ago)
- Location:
- ez_publish/ezipb/trunk
- Files:
-
- 3 modified
-
autoloads/ezipb_operators.php (modified) (13 diffs)
-
autoloads/eztemplateautoload.php (modified) (1 diff)
-
classes/ezipb.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ez_publish/ezipb/trunk/autoloads/ezipb_operators.php
r17 r18 24 24 * ###################### END LICENSE BLOCK #################### 25 25 * 26 * Opérateur de templates pour eZ publish.26 * Opérateurs de templates pour eZ publish. 27 27 * 28 28 * @author Guillaume Kulakowski <guillaume_AT_llaumgui_DOT_com> … … 33 33 34 34 /** 35 * Class contenant les opérateur d'ezipb35 * Class contenant les opérateurs de l'extension ezipb 36 36 * 37 37 */ … … 41 41 private $ezipb; 42 42 private $ipsclass; 43 44 /*! 43 44 45 46 /** 45 47 * Constructor 46 48 */ … … 48 50 49 51 /* Instanciation d'ezipb */ 50 if ( !isset( $this->ezipb) ) { 51 require_once( eZExtension::baseDirectory() . '/ezipb/classes/ezipb.php' ); 52 $this->ezipb = new ezipb; 53 $this->ipsclass =& $this->ezipb->ipsclass; 54 } 52 require_once( eZExtension::baseDirectory() . '/ezipb/classes/ezipb.php' ); 53 $this->ezipb = ezipb::instance(); 54 $this->ipsclass =& $this->ezipb->ipsclass; 55 55 56 56 /* Opérateurs */ … … 60 60 'ezipb_member', 61 61 'ezipb_md5_check', 62 'ezipb_vars' ,63 'ezipb_fetch_topic' );64 } 65 62 'ezipb_vars' ); 63 } 64 65 66 66 67 67 /* 68 * Fonctions génériques d'opérateurs (héritage ?) 68 * Fonctions génériques d'opérateurs 69 * (pourquoi pas d'héritage ou implémentation ?) 69 70 */ 70 71 function &operatorList() { 71 72 return $this->Operators; 72 73 } 74 73 75 function namedParameterPerOperator() { 74 76 return true; 75 77 } 76 78 77 78 79 79 function namedParameterList() { 80 80 81 return array( 'ezipb_isloggin' => array( ),82 'ezipb_is modo' => array( 'member_id' => array( 'type' => 'string', 'required' => false, 'default' => '' )),83 'ezipb_isadmin' => array( 'member_id' => array( 'type' => 'string', 'required' => false, 'default' => '' )),81 return array( 'ezipb_isloggin' => array(), 82 'ezipb_issupermodo' => array(), 83 'ezipb_isadmin' => array(), 84 84 'ezipb_member' => array( 'index' => array( 'type' => 'string', 'required' => false, 'default' => '' ) ), 85 85 'ezipb_md5_check' => array(), 86 86 'ezipb_vars' => array( 'index' => array( 'type' => 'string', 'required' => false, 'default' => '' ) ), 87 'ezipb_fetch_topic' => array( 'options' => array( 'type' => 'array', 'required' => false, 'default' => array() ) )88 87 ); 89 88 } 90 91 92 89 93 90 function modify( &$tpl, &$operatorName, &$operatorParameters, &$rootNamespace, … … 97 94 98 95 case 'ezipb_isloggin': 99 $operatorValue = $this-> ezipb_isloggin();100 break; 101 case 'ezipb_is modo':102 $operatorValue = $this-> ezipb_isadmin( $namedParameters['member_id']);96 $operatorValue = $this->isLoggin(); 97 break; 98 case 'ezipb_issupermodo': 99 $operatorValue = $this->isSuperModo(); 103 100 break; 104 101 case 'ezipb_isadmin': 105 $operatorValue = $this-> ezipb_isadmin( $namedParameters['member_id']);102 $operatorValue = $this->isAdmin(); 106 103 break; 107 104 case 'ezipb_member': 108 $operatorValue = $this-> ezipb_member( $namedParameters['index'] );105 $operatorValue = $this->getMember( $namedParameters['index'] ); 109 106 break; 110 107 case 'ezipb_md5_check': … … 112 109 break; 113 110 case 'ezipb_vars': 114 $operatorValue = $this-> ezipb_vars( $namedParameters['index'] );115 break; 116 case 'ezipb_fetch_topic':111 $operatorValue = $this->getVars( $namedParameters['index'] ); 112 break; 113 /*case 'ezipb_fetch_topic': 117 114 $operatorValue = $this->ezipb_fetch_topic( $namedParameters['options'] ); 118 break; 115 break;*/ 119 116 } 120 117 } 121 118 119 122 120 123 121 /** … … 126 124 * @return boolean 127 125 */ 128 function ezipb_isloggin() {126 private function isLoggin() { 129 127 130 128 if ( $this->ipsclass->member['id'] > 0 ) … … 136 134 137 135 /** 136 * Le membre est il super modérateur ? 137 * 138 * @return Booléen 139 */ 140 private function isSuperModo() { 141 142 if ($this->ipsclass->member['g_is_supmod']) 143 return true; 144 else 145 return false; 146 } 147 148 149 150 /** 138 151 * Le membre est il administrateur ? 139 152 * 140 * @param int $memberid id du membre à checker141 153 * @return Booléen 142 154 */ 143 function ezipb_isadmin( $memberid = '' ) { 144 145 if (!$memberid) { 146 // Current Member 147 if ($this->ipsclass->member['g_access_cp']) { 148 return TRUE; 149 } else { 150 return FALSE; 151 } 152 } 153 else { 154 /* @TODO */ 155 } 156 } 157 158 159 /** 160 * Récupération des information sur le membre. 155 private function isAdmin() { 156 157 if ($this->ipsclass->member['g_access_cp']) 158 return true; 159 else 160 return false; 161 } 162 163 164 165 /** 166 * Récupération des informations sur le membre. 161 167 * 162 168 * @param String $index Index du tableau à récupérer 163 169 * @return mixed 164 170 */ 165 function ezipb_member ( $index ) {171 private function getMember ( $index ) { 166 172 167 173 //print_r( $this->ipsclass->member ); … … 182 188 * @return mixed 183 189 */ 184 function ezipb_vars ( $index ) {190 private function getVars ( $index ) { 185 191 186 192 if ( empty( $index ) ) … … 209 215 * @return array Infos sur les postes 210 216 */ 211 function ezipb_fetch_topic ( $options ) {212 213 / * Valeurs par défauts */217 /*function ezipb_fetch_topic ( $options ) { 218 219 / * Valeurs par défauts * / 214 220 if ( !array_key_exists( 'sort_by', $options ) || !is_array( $options['sort_by']) ) 215 221 $options['sort_by'] = array( 'last_post', false ); … … 219 225 $options['limit'] = 0; 220 226 221 /* true() or false() - ascending or descending * /227 /* true() or false() - ascending or descending * / 222 228 if ( $options['sort_by'][1] ) 223 229 $options['sort_by'][1] = 'ASC'; … … 251 257 } 252 258 return $ezipb_fetch_topic; 253 } 259 }*/ 254 260 255 261 } // EOC -
ez_publish/ezipb/trunk/autoloads/eztemplateautoload.php
r17 r18 6 6 'class' => 'ezipbOperators', 7 7 'operator_names' => array( 'ezipb_isloggin', 8 'ezipb_is modo',8 'ezipb_issupermodo', 9 9 'ezipb_isadmin', 10 10 'ezipb_member', 11 11 'ezipb_md5_check', 12 'ezipb_vars', 13 'ezipb_fetch_topic' ) 12 'ezipb_vars' ) 14 13 ); 15 14 ?> -
ez_publish/ezipb/trunk/classes/ezipb.php
r9 r18 39 39 40 40 41 /* !42 * Construct or41 /** 42 * Constructeur 43 43 */ 44 44 function __construct() { … … 83 83 //echo "<pre>" . print_r( $this->ipsclass->DB->obj['cached_queries'] ) . "</pre>"; 84 84 } 85 } 85 86 87 /** 88 * Permet d'instancier l'objet ezipb. 89 * 90 * @return object ezipb 91 */ 92 static function instance() { 93 94 $impl =& $GLOBALS["ezipbGlobalInstance"]; 95 96 $class = strtolower( get_class( $impl ) ); 97 if ( $class != "ezipb" ) 98 $impl = new ezipb(); 99 100 return $impl; 101 } 102 103 } // EOC 86 104 87 105 ?>
