示例#1
0
 /**
  * Gets the page reminded editors for an edition
  *
  * @param integer $edition The edition the user should have made to be returned
  * @return array(CMS_profile_user) The editors
  * @access public
  */
 function getRemindedEditors($edition)
 {
     $elements = $this->_remindedEditors->getElementsWithOneValue($edition, 2);
     $editors = array();
     foreach ($elements as $element) {
         $user = CMS_profile_usersCatalog::getByID($element[0]);
         if ($user) {
             $editors[] = $user;
         }
     }
     return $editors;
 }
示例#2
0
 /**
  * Get the editors for an edition, or all the editors if no edition given.
  *
  * @param integer $edition We want the editors that edited this edition, or all if it's set to false
  * @return array(CMS_profile_user) The users, or an empty array if none found
  * @access public
  */
 function getEditors($edition = false)
 {
     if ($edition) {
         $usersIDs = $this->_editors->getElementsWithOneValue($edition, 2);
     } else {
         $usersIDs = $this->_editors->getElements();
     }
     $users = array();
     foreach ($usersIDs as $userID) {
         $user = CMS_profile_usersCatalog::getByID($userID[0]);
         if (is_a($user, 'CMS_profile_user') && !$user->hasError()) {
             $users[] = $user;
         }
     }
     return $users;
 }
示例#3
0
 /**
  * Does the template has the specified group in its stack ?.
  *
  * @param string $group The group we want to test
  * @return boolean true if the template belongs to that group, false otherwise
  * @access public
  */
 function belongsToGroup($group)
 {
     $grps = $this->_groups->getElementsWithOneValue($group, 1);
     return is_array($grps) && $grps;
 }
示例#4
0
 /**
  * Check if user has a clearance
  *
  * @param CMS_stack $clearances
  * @param integer $id
  * @param integer $clearance
  * @return boolean
  * @access private
  */
 protected function _hasClearance($clearances, $id, $clearance)
 {
     if (!SensitiveIO::isPositiveInteger($clearance) && $clearance != 0) {
         return false;
     }
     $clearanceOk = false;
     if ($aClearance = $clearances->getElementsWithOneValue($id, 1)) {
         foreach ($aClearance as $element) {
             if ($element[1] >= $clearance) {
                 $clearanceOk = true;
                 break;
             }
         }
     }
     return $clearanceOk;
 }