コード例 #1
0
ファイル: Queue.class.php プロジェクト: pthreat/apf-dev
 public function fetch($limit = 1, $offset = 0, $pid = NULL, $wherePid = FALSE)
 {
     $table = new \apf\db\mysql5\Table($this->_table);
     $select = new \apf\db\mysql5\Select($table);
     $fields = array("id", "estado", "uri", "categoria", "pais", "provincia");
     $select->fields($fields);
     $where = array(array("field" => "estado", "operator" => "!=", "value" => "-1"), array("operator" => "AND"), array("field" => "estado", "operator" => "!=", "value" => "1"));
     if ($wherePid) {
         $where[] = array("operator" => "AND");
         $where[] = array("field" => "pid", "value" => $pid);
     }
     if ($offset > 0) {
         $select->offset($offset);
     }
     $select->where($where);
     $select->limit(array($limit));
     $uris = $select->execute($smartFetch = FALSE);
     $returnQueue = array();
     $class = __CLASS__;
     foreach ($uris as $uri) {
         $queue = new $class();
         $queue->setId($uri["id"]);
         $queue->setEstado('-1');
         if ($pid) {
             $queue->setPid($pid);
         }
         $queue->update();
         $queue->setUri($uri["uri"]);
         $queue->setCategoria($uri["categoria"]);
         $queue->setPais($uri["pais"]);
         $queue->setProvincia($uri["provincia"]);
         $returnQueue[] = $queue;
     }
     return $returnQueue;
 }
コード例 #2
0
ファイル: Usuario.class.php プロジェクト: pthreat/apf-dev
 public function existeCategoriaUsuario($id_categoria)
 {
     $table = new \apf\db\mysql5\Table("usuarios_categorias");
     $select = new \apf\db\mysql5\Select($table);
     $select->fields(array("id_usuario"));
     $where = array(array("field" => "id_usuario", "value" => $this->getId()), array("operator" => "AND"), array("field" => "id_categoria", "value" => $id_categoria));
     $select->where($where);
     $select->limit(array(1));
     $res = $select->execute();
     if (!sizeof($res)) {
         return FALSE;
     }
     return true;
 }