Example #1
0
 public function __construct($cs)
 {
     if ($cs instanceof Collection) {
         $this->cids = $cs->ids();
     } else {
         $this->cids = Caste::toIds(unflatten($cs));
     }
 }
Example #2
0
 /**
  * Get the visibility flag associated with a caste.
  * This function only works for the session user.
  * @return Group associated with the visibility
  */
 public function casteVisibility(Caste $caste, Group $visibility = null)
 {
     if (!$this->isMe(S::user())) {
         return null;
     }
     if ($visibility !== null && self::rightsVisibilityIsPossible($caste->rights(), $visibility)) {
         XDB::execute('UPDATE  castes_users
                          SET  visibility = {?}
                        WHERE  uid = {?} AND cid = {?}', $visibility->id(), $this->id(), $caste->id());
         if ($this->cuvisibility == null) {
             $this->cuvisibility = array();
         }
         $this->cuvisibility[$caste->id()] = $visibility;
     }
     return empty($this->cuvisibility[$caste->id()]) ? null : $this->cuvisibility[$caste->id()];
 }
Example #3
0
 public function addCaste(Rights $rights)
 {
     if ($this->castes === null) {
         $this->castes = new Collection('Caste');
     }
     $caste = new Caste(array('group' => $this, 'rights' => $rights));
     $caste->insert();
     $this->castes->add($caste);
     return $caste;
 }
Example #4
0
 public function __construct($cs)
 {
     $this->cids = Caste::toIds(unflatten($cs));
 }
 public function __construct($cs)
 {
     if ($cs instanceof Collection) {
         if ($cs->className() != 'Caste') {
             throw new Exception('AIFC_Target constructor takes a Collection<Caste>');
         }
         $this->cids = $cs->ids();
     } else {
         $this->cids = Caste::toIds(unflatten($cs));
     }
 }