function _createContent(&$toReturn)
 {
     $tpl =& new CopixTpl();
     $dao =& CopixDAOFactory::create('Comment');
     $sp =& CopixDAOFactory::createSearchConditions();
     $sp->addCondition('id_cmt', '=', $this->params['id']);
     $sp->addCondition('type_cmt', '=', $this->params['type']);
     $sp->addItemOrder('position_cmt', 'desc');
     $arData = $dao->findBy($sp);
     if (count($arData) > 0) {
         $perPage = isset($this->params['perPage']) ? intval($this->params['perPage']) : intval(CopixConfig::get('comment|perPage'));
         $params = array('perPage' => $perPage, 'delta' => 5, 'recordSet' => $arData, 'template' => '|pager.tpl');
         $Pager = CopixPager::Load($params);
         $tpl->assign('pager', $Pager->GetMultipage());
         $tpl->assign('comments', $Pager->data);
     }
     $tpl->assign('back', $this->params['back']);
     $tpl->assign('id', $this->params['id']);
     $tpl->assign('type', $this->params['type']);
     $adminEnabled = CopixUserProfile::valueOf('site', 'siteAdmin') >= PROFILE_CCV_MODERATE;
     $tpl->assign('adminEnabled', $adminEnabled);
     $plugAuth =& $GLOBALS['COPIX']['COORD']->getPlugin('auth|auth');
     $user =& $plugAuth->getUser();
     $tpl->assign('login', $user->login);
     $toReturn = $tpl->fetch('comment.list.tpl');
     return true;
 }
 /**
  * Publicator will see all picture they could publish
  */
 function performQuickAdminBrowsing($event, &$eventResponse)
 {
     if (CopixUserProfile::valueOf('site', 'siteAdmin') >= PROFILE_CCV_MODERATE) {
         $content = CopixZone::process('comment|CommentQuickAdmin');
         if (strlen($content) > 0) {
             $eventResponse->add(array('caption' => CopixI18N::get('comment|comment.shortDescription'), 'module' => 'comment', 'content' => $content));
         }
     }
 }
 /**
  * Test if the CopixUserProfile match the required Profile informations (if asked)
  */
 function beforeProcess(&$execParams)
 {
     if (isset($execParams->params['profile|profile'])) {
         if (is_a($execParams->params['profile|profile'], 'CapabilityValueOf')) {
             $ok = CopixUserProfile::valueOf($execParams->params['profile|profile']->path, $execParams->params['profile|profile']->cap) >= $execParams->params['profile|profile']->value;
         } else {
             if (is_a($execParams->params['profile|profile'], 'CapabilityValueIn')) {
                 $ok = CopixUserProfile::valueIn($execParams->params['profile|profile']->basePath, $execParams->params['profile|profile']->cap) >= $execParams->params['profile|profile']->value;
             } else {
                 $ok = true;
             }
         }
         if (!$ok) {
             $execParams = $this->config->noRightsExecParams;
             return false;
         }
         return true;
     }
     return true;
 }
 /**
  * Prepare to edit comment
  */
 function doPrepareEdit()
 {
     if (!isset($this->vars['back']) || !isset($this->vars['id_cmt']) || !isset($this->vars['type_cmt']) || !isset($this->vars['position_cmt'])) {
         return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('comment.error.missingParameter')));
     }
     $dao =& COPIXDAOFactory::create('Comment');
     if (!($toEdit = $dao->get($this->vars['id_cmt'], $this->vars['type_cmt'], $this->vars['position_cmt']))) {
         return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('comment.error.unabletoGetComment')));
     }
     $plugAuth =& $GLOBALS['COPIX']['COORD']->getPlugin('auth|auth');
     $user =& $plugAuth->getUser();
     //check right
     if (CopixUserProfile::valueOf('site', 'siteAdmin') < PROFILE_CCV_MODERATE && $user->login != $toEdit->author_cmt) {
         return CopixActionGroup::process('genericTools|Messages::getError', array('message' => CopixI18N::get('comment.error.unableToUpdate')));
     }
     $toEdit->INTERNAL_COPIX_IsNew = false;
     $toEdit->back = $this->vars['back'];
     $toEdit->backToComment = isset($this->vars['backToComment']);
     $this->_setSessionComment($toEdit);
     return new CopixActionReturn(COPIX_AR_REDIRECT, CopixUrl::get('comment||edit'));
 }
 /**
  * gets the groups the user belongs to.
  * @access public
  * @return array of CopixGroups
  */
 function getGroups()
 {
     $me =& CopixUserProfile::instance();
     return $me->profile->getGroups();
 }