Exemplo n.º 1
0
 public function __construct($cs)
 {
     if ($cs instanceof Collection) {
         $this->cids = $cs->ids();
     } else {
         $this->cids = Caste::toIds(unflatten($cs));
     }
 }
Exemplo n.º 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()];
 }
Exemplo n.º 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;
 }
Exemplo n.º 4
0
 public function __construct($cs)
 {
     $this->cids = Caste::toIds(unflatten($cs));
 }
Exemplo n.º 5
0
 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));
     }
 }