Exemplo n.º 1
0
 private function SaveNewMemberGroups(array $selectedIDs, array $exIDs)
 {
     foreach ($selectedIDs as $selID) {
         if (!in_array($selID, $exIDs)) {
             $cntMg = new ContentMembergroup();
             $cntMg->SetContent($this->Content());
             $cntMg->SetMemberGroup(new Membergroup($selID));
             $cntMg->Save();
         }
     }
 }
Exemplo n.º 2
0
 /**
  * Gets the content's member groups
  * @param Content $content
  * @return Membergroup[] Returns the member groups assigned to the content
  */
 static function ContentMembergroups(Content $content)
 {
     if (!$content->Exists()) {
         return array();
     }
     $sql = Access::SqlBuilder();
     $tblCmg = ContentMembergroup::Schema()->Table();
     $tblMg = Membergroup::Schema()->Table();
     $join = $sql->Join($tblCmg);
     $joinCondition = $sql->Equals($tblCmg->Field('MemberGroup'), $tblMg->Field('ID'));
     $where = $sql->Equals($tblCmg->Field('Content'), $sql->Value($content->GetID()));
     $orderBy = $sql->OrderList($sql->OrderAsc($tblMg->Field('Name')));
     return Membergroup::Schema()->Fetch(false, $where, $orderBy, null, 0, null, $join, JoinType::Inner(), $joinCondition);
 }