public function __construct() { //pre-load enic classes enic::to_load('matrix'); //load enic classes in current object : $this->user =& enic::get('user'); $this->options =& enic::get('options'); $this->matrix =& enic::get('matrixCache'); $this->model =& enic::get('model'); $this->db =& enic::get('model'); $this->js =& enic::get('javascript'); $this->css =& enic::get('css'); $this->session =& enic::get('session'); $this->flash =& enic::get('flash'); $this->html =& enic::get('html'); $this->helpers =& enic::get('helpers'); //define properties : $this->module = $this->helpers->module; $this->actiongroup = $this->helpers->actiongroup; $this->action = $this->helpers->action; }
public static function load($type, $name = null) { //load file enic::to_load($type); //get name $name = !empty($name) ? enic::sanitize($name) : $type; if (in_array($name, self::$l)) { trigger_error('Item <em>' . $name . '</em> in <strong>ENIC ROOT CORE</strong> already exists', E_USER_WARNING); } //load class in local ref $className = 'enic' . ucfirst($type); self::$l[$name] = new $className(); //add name attribute self::$l[$name]->_name = $name; //execute the startExec self::$l[$name]->startExec(); //test if the class is a containor class : if (method_exists(self::$l[$name], 'getClass')) { self::$l[$name] =& self::$l[$name]->getClass(); } return self::$l[$name]; }
public function __construct() { //test the user connexion, desactivate for public access //_currentUser()->assertCredential ('group:[current_user]'); //pre-load enic classes enic::to_load('matrix'); //load enic classes in current object : $this->user =& enic::get('user'); $this->options =& enic::get('options'); $this->matrix =& enic::get('matrixCache'); $this->model =& enic::get('model'); $this->db =& enic::get('model'); $this->js =& enic::get('javascript'); $this->css =& enic::get('css'); $this->session =& enic::get('session'); $this->flash =& enic::get('flash'); $this->html =& enic::get('html'); $this->helpers =& enic::get('helpers'); //define properties : $this->module = $this->helpers->module; $this->actiongroup = $this->helpers->actiongroup; $this->action = $this->helpers->action; }
public function __construct() { $this->feed =& enic::get('zend'); enic::to_load('image'); parent::__construct(); }
public function __construct() { parent::__construct(); $this->service =& $this->service('rssmixService'); enic::to_load('image'); }
return $this->iCanDoToThisType($this->listTypeVoir, $user_type_out); } private function iCanDoToThisType($list, $user_type_out) { $userList = array(); foreach ($list as $type) { $userList[] = $type['user_type_out']; } return in_array($user_type_out, $userList); } } /* MATRIX MAIN CLASS */ /* * test the existence of nodematrix */ enic::to_load('nodeMatrix'); class enicMatrix extends enicList { public function startExec() { $options =& enic::get('options'); $options = $options->matrix; $this->bypass = (bool) $options->bypass; //get user info $user =& enic::get('user'); //build the matrix list $this->add('villes')->add('ville')->add('ecole')->add('classe'); //load the groupe node in matrix $this->load('nodeMatrix', 'groupes'); //load the other groups $this->groupes->load('nodeMatrix', '_other');
public function load($type, $name, $content = null, $opt = null) { //test if class already loaded by enic core $className = 'enic' . ucfirst($type); if (!class_exists($className)) { enic::to_load($type); } return $this->add($name, $content, $opt, $type); }
<?php /* * Class de cache automatisé * * La classe se base sur le nom de la class appelante pour appeler le cache : enicMatricCache => class enicMatrix */ enic::to_load('storage'); class enicCache extends enicMod { public $storage; public $validity; public $range; public function __construct() { parent::__construct(); //define storage : if (empty($this->storage)) { $this->storage = 'session'; } $this->storage = $this->storage . 'Cache'; //define validity : if (empty($this->validity)) { $this->validity = 3600; } return true; } //if enicCache is extended : return the extended Cache : public function getClass() { //get className (remove 'Cache') :
public function load($type, $name, $content = null, $opt = null) { //test if class already loaded by enic core $className = 'enic' . ucfirst($type); if (!class_exists($className)) { enic::to_load($type); } //create computer readable name $nameStr = enic::sanitize($name); //load type if defined else get current type $className = $type !== false ? 'enic' . ucfirst($type) : get_class($this); //test if object already exists if (isset($this->{$nameStr})) { trigger_error('item <em>' . $nameStr . '</em> in <strong>' . $className . '</strong> already exists', E_USER_WARNING); } //load object $this->{$nameStr} = new $className(); $this->_children[] = $nameStr; $this->{$nameStr}->_parent = enic::sanitize($this->_name); $this->{$nameStr}->_parentObject = $this; //load root item $this->{$nameStr}->_root = $this->_root; //load child's data $this->{$nameStr}->_name = $name; $this->{$nameStr}->_content = $content; $this->{$nameStr}->_opt = $opt; //set level $this->{$nameStr}->_level = $this->_level + 1; //exec the addExec methode $this->{$nameStr}->addExec(); //return current objet return $this; }
public function processDefault() { $tpl = new CopixTpl(); $tplModule = new CopixTpl(); if (!$this->user->connected) { return new CopixActionReturn(COPIX_AR_REDIRECT, CopixUrl::get('welcome|default|')); } $tpl->assign('TITLE_PAGE', CopixI18N::get('kernel.title.accueilsimple')); $nodes_all = Kernel::getNodeParents($this->user->type, $this->user->idEn); $nodes_all = Kernel::sortNodeList($nodes_all); // _dump($nodes_all); $nodes = array(); foreach ($nodes_all as $node) { if ($node['type'] == 'CLUB' && CopixConfig::exists('kernel|groupeAssistance') && ($groupeAssistance = CopixConfig::get('kernel|groupeAssistance')) && $node['id'] == $groupeAssistance) { continue; } if ($node['type'] == 'CLUB' && $node['droit'] < 20) { continue; } if (!isset($nodes[$node['type']])) { $nodes[$node['type']] = array(); } //module not initialized : loaded into inconito if (!isset($nodes[$node['type']][$node['id']])) { $nodes[$node['type']][$node['id']] = $node; Kernel::createMissingModules($node['type'], $node['id']); $nodes[$node['type']][$node['id']]['modules'] = Kernel::getModEnabled($node['type'], $node['id'], $this->user->type, $this->user->idEn, 0, count($nodes_all) > $this->conf_notification_maxnodes ? 0 : 1); // Cas des groupes : on ajoute les membres et admin, selon les droits if ($node['type'] == 'CLUB') { $addModule = new CopixPPO(); $addModule->node_type = $node['type']; $addModule->node_id = $node['id']; $addModule->module_type = 'MOD_ADMIN'; $addModule->module_id = 0; $addModule->module_nom = CopixI18N::get('groupe|groupe.group.admin'); $nodes[$node['type']][$node['id']]['modules'][] = $addModule; } /* * ===== CONTENT GENERATION ===== * */ //cas parent élève if ($node['type'] == 'USER_ELE') { $contentNode = Kernel::getNodeParents($node['type'], $node['id']); $contentNode = Kernel::filterNodeList($contentNode, 'BU_CLASSE'); if (empty($contentNode)) { continue; } $contentNode = $contentNode[0]; } else { $contentNode = $node; } //get content from db : $content = $this->db->query('SELECT * FROM module_admindash WHERE id_zone = ' . $contentNode['id'] . ' AND type_zone = "' . $contentNode['type'] . '"')->toArray1(); // Get vocabulary catalog to use $nodeVocabularyCatalogDAO = _ioDAO('kernel|kernel_i18n_node_vocabularycatalog'); $vocabularyCatalog = $nodeVocabularyCatalogDAO->getCatalogForNode($contentNode['type'], $contentNode['id']); //if no content : get default content if (empty($content['content'])) { switch ($contentNode['type']) { case 'BU_CLASSE': case 'USER_ELE': $content['content'] = CopixZone::process('kernel|dashboardClasse', array('idZone' => $contentNode['id'], 'catalog' => $vocabularyCatalog->id_vc)); break; case 'BU_ECOLE': $content['content'] = CopixZone::process('kernel|dashboardEcole', array('idZone' => $contentNode['id'], 'catalog' => $vocabularyCatalog->id_vc)); break; case 'BU_VILLE': $content['content'] = CopixZone::process('kernel|dashboardVille', array('idZone' => $contentNode['id'], 'catalog' => $vocabularyCatalog->id_vc)); break; case 'CLUB': $content['content'] = CopixZone::process('kernel|dashboardGrTravail', array('idZone' => $contentNode['id'], 'catalog' => $vocabularyCatalog->id_vc)); break; case 'ROOT': if ($contentNode['droit'] >= 60) { $contentTpl = new CopixTpl(); $content['content'] = $contentTpl->fetch('zone.dashboard.root.tpl'); } else { $contentTpl = new CopixTpl(); $content['content'] = $contentTpl->fetch('zone.dashboard.userext.tpl'); } break; default: $content['content'] = ''; break; } } //twitter integration $twitterSrc = ''; if (!empty($content['social_stream'])) { enic::to_load('social'); $twitter = new enicSocialTwitter(); $twitterSrc = $content['social_stream']; } //is admin : $is_admin = $contentNode['droit'] >= 60; //build html content $content_tpl = new CopixTpl(); $content_tpl->assign('content', $content['content']); if (!empty($content['picture'])) { $content_tpl->assign('picture', $content['picture']); $content_tpl->assign('picturePath', $this->picturesPath); } $content_tpl->assign('twitter', $twitterSrc); $content_tpl->assign('is_admin', $is_admin); $content_tpl->assign('id', $contentNode['id']); $content_tpl->assign('type', $contentNode['type']); $content_tpl->assign('catalog', $vocabularyCatalog->id_vc); if ($contentNode['type'] == "BU_ECOLE") { $content_tpl->assign('idZone', $contentNode['id']); } $content = $content_tpl->fetch('dashboard.nodes.tpl'); //add css $this->addCss('styles/dashboard_zone.css'); //free memory unset($content_tpl); /* * ===== END CONTENT GENERATION ===== */ $nodes[$node['type']][$node['id']]['content'] = $content; } elseif ($nodes[$node['type']][$node['id']]['droit'] < $node['droit']) { $nodes[$node['type']][$node['id']] = $node; } } if (CopixConfig::exists('|use_class_validity') && CopixConfig::get('|use_class_validity')) { $tplModule->assign("use_class_validity", 1); if (isset($nodes['BU_CLASSE'])) { foreach ($nodes['BU_CLASSE'] as $classe_id => $classe_data) { $validity_timestamp = Kernel::getValidityDateForClass($classe_data['id']); if ($validity_timestamp) { $nodes['BU_CLASSE'][$classe_id]['validity_timestamp'] = $validity_timestamp; $nodes['BU_CLASSE'][$classe_id]['validity_date'] = date('d/m/Y', $validity_timestamp); // Si l'école existe : mémoriser max validity if (isset($nodes['BU_ECOLE'][$nodes['BU_CLASSE'][$classe_id]['ALL']->cla_ecole])) { if (!isset($nodes['BU_ECOLE'][$nodes['BU_CLASSE'][$classe_id]['ALL']->cla_ecole]['validity_timestamp']) || $nodes['BU_ECOLE'][$nodes['BU_CLASSE'][$classe_id]['ALL']->cla_ecole]['validity_timestamp'] < $validity_timestamp) { $nodes['BU_ECOLE'][$nodes['BU_CLASSE'][$classe_id]['ALL']->cla_ecole]['validity_timestamp'] = $validity_timestamp; $nodes['BU_ECOLE'][$nodes['BU_CLASSE'][$classe_id]['ALL']->cla_ecole]['validity_date'] = date('d/m/Y', $validity_timestamp); } } } } } $count_validity_ok = 0; $count_validity_bad = 0; foreach ($nodes as $node_type => $node_type_list) { foreach ($node_type_list as $node_id => $node) { if (isset($nodes[$node_type][$node_id]['validity_timestamp'])) { if ($nodes[$node_type][$node_id]['validity_timestamp'] < time()) { unset($nodes[$node_type][$node_id]); $count_validity_bad++; } else { $count_validity_ok++; } } } } } else { $tplModule->assign("use_class_validity", 0); } /* DRAFT WORKING */ // _dump($nodes); /* $rClasse = Kernel::getNodeInfo ('BU_CLASSE', $nodes['BU_CLASSE'][1]['id'], false); CopixZone::process ('annuaire|infosclasse', array('rClasse'=>$rClasse)); */ //echo $this->matrix->display(); // _dump($nodes); $tplModule->assign("nodes", $nodes); if (count($nodes) == 0) { $result = $tplModule->fetch("dashboard-empty.tpl"); } else { $result = $tplModule->fetch("dashboard.tpl"); } $tpl->assign('MAIN', $result); return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl); }
<?php enic::to_load('load'); class enicService extends enicLoad { /* * CONSTRUCTOR */ public function __construct() { parent::__construct(); } }