Пример #1
0
 public function saveUsuarisMenusList($con = null)
 {
     if (!$this->isValid()) {
         throw $this->getErrorSchema();
     }
     if (!isset($this->widgetSchema['usuaris_menus_list'])) {
         // somebody has unset this widget
         return;
     }
     if (null === $con) {
         $con = $this->getConnection();
     }
     $c = new Criteria();
     $c->add(UsuarisMenusPeer::MENU_ID, $this->object->getPrimaryKey());
     UsuarisMenusPeer::doDelete($c, $con);
     $values = $this->getValue('usuaris_menus_list');
     if (is_array($values)) {
         foreach ($values as $value) {
             $obj = new UsuarisMenus();
             $obj->setMenuId($this->object->getPrimaryKey());
             $obj->setUsuariId($value);
             $obj->save();
         }
     }
 }
Пример #2
0
 public static function initialize($idU, $idM, $idS)
 {
     $OO = UsuarisMenusPeer::retrieveByPK($idU, $idM, $idS);
     if (!$OO instanceof UsuarisMenus) {
         $OO = new UsuarisMenus();
         $OO->setUsuariId($idU);
         $OO->setMenuId($idM);
         $OO->setSiteId($idS);
         $OO->setNivellId(NivellsPeer::REGISTRAT);
         $OO->setActiu(true);
     }
     return new UsuarisMenusForm($OO, array('IDS' => $idS));
 }