Exemple #1
0
 /**
  * @param MPCEGroup|MPCEGroup[] $group
  */
 public function addGroup($group)
 {
     if ($group instanceof MPCEGroup) {
         if ($group->isValid()) {
             if (!array_key_exists($group->getId(), $this->library)) {
                 if (count($group->getObjects()) > 0) {
                     $this->library[$group->getId()] = $group;
                 }
             }
         } else {
             if (!self::$isAjaxRequest) {
                 $group->showErrors();
             }
         }
     } elseif (is_array($group)) {
         if (!empty($group)) {
             foreach ($group as $g) {
                 if ($g instanceof MPCEGroup) {
                     if ($g->isValid()) {
                         if (!array_key_exists($g->getId(), $this->library)) {
                             if (count($g->getObjects()) > 0) {
                                 $this->library[$g->getId()] = $g;
                             }
                         }
                     } else {
                         if (!self::$isAjaxRequest) {
                             $g->showErrors();
                         }
                     }
                 }
             }
         }
     }
 }