コード例 #1
0
 /**
  * Set component settings
  *
  * setSettings should have array() to accept values #434
  *
  * @param  string $component Component id
  * @param  array vars Setting (two-dem array)
  *
  * @return boolean
  */
 public function setSettings($component, array $vars = array())
 {
     $settings = self::getComSettings($component);
     $guid = $this->getbyName($component)->getID();
     $entity = new OssnEntities();
     if (empty($guid)) {
         return false;
     }
     foreach ($vars as $name => $value) {
         if ($settings && !$settings->isParam($name)) {
             $entity->owner_guid = $guid;
             $entity->type = 'component';
             $entity->subtype = $name;
             $entity->value = $value;
             $entity->add();
         } else {
             $entity->owner_guid = $guid;
             $entity->type = 'component';
             $entity->data->{$name} = $value;
             $entity->save();
         }
     }
     return true;
 }
コード例 #2
0
ファイル: OssnUser.php プロジェクト: nongdanit-nongdanit/ossn
 /**
  * Save a user entity
  *
  * @return boolean
  */
 public function save()
 {
     if (!isset($this->guid) || empty($this->guid)) {
         return false;
     }
     $this->owner_guid = $this->guid;
     $this->type = 'user';
     if (parent::save()) {
         //check if owner is loggedin user guid , if so update session
         if (ossn_loggedin_user()->guid == $this->guid) {
             $_SESSION['OSSN_USER'] = ossn_user_by_guid($this->guid);
         }
         return true;
     }
     return false;
 }