示例#1
0
文件: asset.php 项目: nexgenta/media
 public static function objectForData($data, $model = null, $className = null)
 {
     if (!$model) {
         $model = Media::getInstance();
     }
     if (!strlen($className) || $className == 'Asset') {
         if (!isset($data['kind'])) {
             $data['kind'] = 'asset';
         }
         switch ($data['kind']) {
             case 'asset':
                 $className = 'Asset';
                 break;
             case 'scheme':
                 require_once dirname(__FILE__) . '/scheme.php';
                 $className = 'Scheme';
                 break;
             case 'resource':
                 require_once dirname(__FILE__) . '/resource.php';
                 $className = 'Resource';
                 break;
             case 'version':
                 require_once dirname(__FILE__) . '/version.php';
                 $className = 'Version';
                 break;
             case 'episode':
             case 'clip':
                 require_once dirname(__FILE__) . '/episode.php';
                 $className = 'Episode';
                 break;
             case 'show':
             case 'series':
                 require_once dirname(__FILE__) . '/show.php';
                 $className = 'Show';
                 break;
             default:
                 if ($cs = $model->locateObject('[scheme:' . $data['kind'] . ']', null, 'scheme')) {
                     require_once dirname(__FILE__) . '/classification.php';
                     $className = 'Classification';
                     break;
                 }
                 trigger_error('Asset::objectForData(): No suitable class for a "' . $data['kind'] . '" asset is available', E_USER_NOTICE);
                 return null;
         }
     }
     return parent::objectForData($data, $model, $className);
 }
示例#2
0
文件: thing.php 项目: nexgenta/weaver
 public static function objectForData($data, $model = null, $className = null)
 {
     if (!$model) {
         $model = Weaver::getInstance();
     }
     if (!strlen($className) || $className == 'Thing') {
         if (!isset($data['kind'])) {
             $data['kind'] = 'thing';
         }
         switch ($data['kind']) {
             case 'universe':
                 require_once dirname(__FILE__) . '/universe.php';
                 $className = 'Universe';
                 break;
             case 'character':
                 require_once dirname(__FILE__) . '/character.php';
                 $className = 'Character';
                 break;
             case 'story':
                 require_once dirname(__FILE__) . '/story.php';
                 $className = 'Story';
                 break;
             case 'thing':
                 $className = 'Thing';
                 break;
             case 'event':
                 require_once dirname(__FILE__) . '/event.php';
                 $className = 'Event';
                 break;
             default:
                 trigger_error('Thing::objectForData(): No suitable class for a "' . $data['kind'] . '" thing is available', E_USER_NOTICE);
                 return null;
         }
     }
     return parent::objectForData($data, $model, $className);
 }
示例#3
0
文件: rss.model.php 项目: Jatax/TKS
 /**
  * Modifie un flux RSS
  * @return type
  */
 public function update()
 {
     $aDatas = array('id_tracker' => $this->iTracker, 'url' => $this->sUrl, 'forcedate' => $this->bForcedate ? '1' : '0', 'mask' => $this->sMask, 'encoding' => $this->sEncoding);
     return parent::update('tks_rss', $aDatas, $this->iId);
 }
示例#4
0
 /**
  * Supprime une invitation de la BDD
  * @return mixed
  */
 public function delete()
 {
     return parent::delete('tks_invites', $this->sCode, 'code');
 }
示例#5
0
 /**
  * Modifie un tracker
  * 
  * @return mixed
  * @throws Error
  */
 public function update()
 {
     $aDatas = array('name' => $this->sName, 'link' => $this->sLink, 'directlink' => $this->sDirectLink);
     return parent::update('tks_trackers', $aDatas, $this->iId);
 }
示例#6
0
 /**
  * Ajoute une permission à la base de données
  * 
  * @return mixed
  * @throws Error
  */
 public function store()
 {
     $aFields = array('id_rank', 'id_module');
     $aDatas = array($this->iRankId, $this->iModuleId);
     return parent::insert('tks_permissions', $aFields, $aDatas);
 }
示例#7
0
文件: user.model.php 项目: Jatax/TKS
 /**
  * Modifie un utilisateur
  * 
  * @return mixed
  * @throws Error
  */
 public function update()
 {
     $aDatas = array('login' => $this->sLogin, 'mail' => $this->sMail, 'id_rank' => $this->iRankId);
     if ($this->sPassword != '') {
         $aDatas['pass'] = $this->sPassword;
     }
     return parent::update('tks_users', $aDatas, $this->iId);
 }
示例#8
0
 /**
  * Modifie une clé API
  * @return lixed
  */
 public function update()
 {
     $aDatas = array('read' => $this->bRead ? '1' : '0', 'write' => $this->bWrite ? '1' : '0');
     return parent::update('tks_apikeys', $aDatas, $this->sKey, 'apikey');
 }
示例#9
0
 /**
  * Essai de scrapper un sport
  * @return boolean Vrai si c'est un sport
  */
 private function trySport()
 {
     if ($this->checkTags(8)) {
         $this->iCategorieId = 8;
         $this->sFicheId = 'N/A';
         $aDatas = array('id_categorie' => $this->iCategorieId);
         parent::update('tks_releases', $aDatas, $this->iReleaseId);
         return true;
     } else {
         return false;
     }
 }
示例#10
0
文件: fiche.model.php 项目: Jatax/TKS
 /**
  * Signal la fiche aux modérateurs
  * @param int $p_iIdUser Utilisateur signalant la fiche
  * @param string $p_sComment Commentaire
  * @return mixed
  */
 public function signal($p_iIdUser, $p_sComment)
 {
     $aFields = array('id_fiche', 'type', 'id_user', 'comment');
     $aDatas = array($this->iId, $this->sType, $p_iIdUser, addslashes($p_sComment));
     return parent::insert('tks_signaled_fiches', $aFields, $aDatas);
 }
示例#11
0
 /**
  * En base a una tabla y un objeto elimina el mismo de la base de datos
  * @param type $table
  * @param \Enola\DB\Storable $object
  * @return boolean
  * @throws \PDOException
  */
 public function deleteObject($table, Storable $object)
 {
     try {
         //Armo el Where
         $where = '';
         foreach ($object->keys() as $key => $value) {
             if ($where != '') {
                 $where = 'AND ';
             }
             $where .= $key . '=:' . $key . ' ';
         }
         //Armo y preparo la consulta
         $query = $this->prepareDelete($table, $where);
         //Ejecuto la consulta
         $query->execute($object->keys());
         $error = $query->errorInfo();
         if ($error[0] != '00000') {
             $this->catchError($error);
             return FALSE;
         } else {
             return TRUE;
         }
     } catch (\PDOException $e) {
         throw $e;
     }
 }
示例#12
0
 /**
  * Modifie une release
  * 
  * @return mixed
  * @throws Error
  */
 public function update()
 {
     $aDatas = array('name' => $this->sName, 'pretime' => $this->sPreTime);
     return parent::update('tks_releases', $aDatas, $this->iId);
 }
示例#13
0
文件: regex.model.php 项目: Jatax/TKS
 /**
  * Modifie un paramètre
  * 
  * @return mixed
  * @throws Error
  */
 public function update()
 {
     $aDatas = array('name' => $this->sName, 'regex' => $this->sRegex, 'id_categorie' => $this->iCategorieId);
     return parent::update('tks_regex', $aDatas, $this->iId);
 }
示例#14
0
 /**
  * Ajoute un passkey
  * @return mixed
  */
 public function store()
 {
     $aFields = array('id_user', 'id_tracker', 'passkey');
     $aDatas = array($this->iUserId, $this->iTrackerId, $this->sPasskey);
     return parent::insert('tks_passkey', $aFields, $aDatas);
 }
示例#15
0
文件: rank.model.php 项目: Jatax/TKS
 /**
  * Modifie un rang
  * 
  * @return mixed
  * @throws Error
  */
 public function update()
 {
     $aDatas = array('name' => $this->sName, 'default' => $this->bDefault ? '1' : '0');
     return parent::update('tks_ranks', $aDatas, $this->iId);
 }
示例#16
0
 function __get($var)
 {
     if ($var === 'thisown') {
         return swig_otapi_get_newobject($this->_cPtr);
     }
     return Storable::__get($var);
 }
示例#17
0
 /**
  * Constructeur par défaut
  */
 function __construct($p_sName, $p_iId = 0)
 {
     parent::__construct();
     $this->sName = $p_sName;
     $this->iId = $p_iId;
 }