Beispiel #1
0
 public static function retrieveByPK($catalog_id, $department_id, $cat_category_id, $col_status_id, $col_location_id, $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(self::DATABASE_NAME);
     }
     $criteria = new Criteria();
     $criteria->add(VOpacPeer::CATALOG_ID, $catalog_id);
     $criteria->add(VOpacPeer::DEPARTMENT_ID, $department_id);
     $criteria->add(VOpacPeer::CAT_CATEGORY_ID, $cat_category_id);
     $criteria->add(VOpacPeer::COL_STATUS_ID, $col_status_id);
     $criteria->add(VOpacPeer::COL_LOCATION_ID, $col_location_id);
     $v = VOpacPeer::doSelect($criteria, $con);
     return !empty($v) ? $v[0] : null;
 }
Beispiel #2
0
 public function filterCollection($c, $filters)
 {
     $filters_key = array_keys($filters);
     foreach ($filters_key as $key) {
         $value = $filters[$key];
         if ($value == '' || $value == null) {
             continue;
         }
         if ($key == 'writer_name') {
             $column = VOpacPeer::getTableMap()->getColumn('WRITER_NAME');
         } elseif ($key == 'code') {
             $c->addJoin(VOpacPeer::CATALOG_ID, CatalogPeer::ID);
             $column = CatalogPeer::getTableMap()->getColumn('CODE');
         } elseif ($key == 'published_year') {
             $column = VOpacPeer::getTableMap()->getColumn('PUBLISHED_YEAR');
         } elseif ($key == 'title') {
             $column = VOpacPeer::getTableMap()->getColumn('TITLE');
         } elseif ($key == 'cat_category_id') {
             $column = VOpacPeer::getTableMap()->getColumn('CAT_CATEGORY_ID');
         } elseif ($key == 'publisher_name') {
             $column = VOpacPeer::getTableMap()->getColumn('PUBLISHER_ID');
         } else {
             $column = VOpacPeer::getTableMap()->getColumn($key);
         }
         $name = $column->getFullyQualifiedName();
         $creoleType = $column->getCreoleType();
         if ($creoleType == CreoleTypes::TIMESTAMP) {
             $from = $value['from'];
             $to = $value['to'];
             if ($from != '' && $from != null) {
                 $c->add($name, $from, Criteria::GREATER_EQUAL);
             }
             if ($to != '' && $to != null) {
                 $c->add($name, $to, Criteria::LESS_EQUAL);
             }
         } else {
             if ($creoleType == CreoleTypes::INTEGER || $creoleType == CreoleTypes::BIGINT) {
                 $c->add($name, $value, Criteria::EQUAL);
             } else {
                 if ($creoleType == CreoleTypes::VARCHAR) {
                     $c->add($name, "%{$value}%", Criteria::LIKE);
                 } else {
                     if ($creoleType == CreoleTypes::NUMERIC) {
                         $c->add($name, $value, Criteria::EQUAL);
                     }
                 }
             }
         }
     }
 }
Beispiel #3
0
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = VOpacPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setCatalogId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setTotalColItem($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setTitle($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setPublisherName($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setPublishedLocation($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setPublishedYear($arr[$keys[5]]);
     }
     if (array_key_exists($keys[6], $arr)) {
         $this->setWriterName($arr[$keys[6]]);
     }
     if (array_key_exists($keys[7], $arr)) {
         $this->setCatCategoryName($arr[$keys[7]]);
     }
     if (array_key_exists($keys[8], $arr)) {
         $this->setDepartmentName($arr[$keys[8]]);
     }
     if (array_key_exists($keys[9], $arr)) {
         $this->setColLocationName($arr[$keys[9]]);
     }
     if (array_key_exists($keys[10], $arr)) {
         $this->setDepartmentId($arr[$keys[10]]);
     }
     if (array_key_exists($keys[11], $arr)) {
         $this->setCatCategoryId($arr[$keys[11]]);
     }
     if (array_key_exists($keys[12], $arr)) {
         $this->setColStatusId($arr[$keys[12]]);
     }
     if (array_key_exists($keys[13], $arr)) {
         $this->setColLocationId($arr[$keys[13]]);
     }
     if (array_key_exists($keys[14], $arr)) {
         $this->setSearchKeywords($arr[$keys[14]]);
     }
 }
Beispiel #4
0
 public function getColItemStatus()
 {
     $status = array();
     $c = new Criteria();
     $c->add(VOpacPeer::CATALOG_ID, $this->getId(), Criteria::EQUAL);
     $status[0] = VOpacPeer::doCount($c);
     $c->add(VOpacPeer::COL_STATUS_ID, ColStatus::AVAILABLE, Criteria::EQUAL);
     $status[1] = VOpacPeer::doCount($c);
     $c->remove(VOpacPeer::COL_STATUS_ID);
     $c->add(VOpacPeer::COL_STATUS_ID, ColStatus::READ, Criteria::EQUAL);
     $status[2] = VOpacPeer::doCount($c);
     $c->remove(VOpacPeer::COL_STATUS_ID);
     $c->add(VOpacPeer::COL_STATUS_ID, ColStatus::LOAN, Criteria::EQUAL);
     $status[3] = VOpacPeer::doCount($c);
     return $status;
 }