Example #1
0
 /**
  * Creates an Comment object based on a DB row.
  *
  * @param array $row The DB row containing Comment data.
  * @return \Manager\Commentaire
  */
 protected function buildDomainObject($row)
 {
     $commentaire = new Commentaire();
     $commentaire->setId($row['id']);
     $commentaire->setContenu($row['contenu']);
     $commentaire->setDateCreation($row['date_creation']);
     if (array_key_exists('id_billet', $row)) {
         // Find and set the associated billet
         $billetId = $row['id_billet'];
         $billet = $this->billetDAO->find($billetId);
         $commentaire->setArticle($billet);
     }
     if (array_key_exists('user_id', $row)) {
         // Find and set the associated author
         $userId = $row['user_id'];
         $user = $this->userDAO->find($userId);
         $commentaire->setAuteur($user);
     }
     return $commentaire;
 }
Example #2
0
 function getUsermenu()
 {
     $app = classes_Singleton::getInstance('classes_controller_ApplicationController');
     $action = classes_Singleton::getInstance('classes_controller_ActionController');
     $allowedActions = $this->dao->getAllowedActionsToUser($this->id);
     $menu = null;
     foreach ($allowedActions as $action) {
         if (!empty($action['menuname']) && $action['inmenu']) {
             if (empty($action['menulevel2'])) {
                 $menu[$action['menulevel1']]['items'][] = array('target' => SITE_ROOT . '/' . $action['application'] . '/' . $action['action'] . '/', 'name' => $action['menuname']);
             } else {
                 $menu[$action['menulevel1']]['submenus'][$action['menulevel2']][] = array('target' => SITE_ROOT . '/' . $action['application'] . '/' . $action['action'] . '/', 'name' => $action['menuname']);
             }
         }
     }
     return $menu;
 }