Exemple #1
0
                                <td style="width: 80%; text-align: left;">
                                <?php 
$status = $catalog->getItemStatus();
echo $status[1] . ' &nbsp;eksemplar';
?>
                                </td>
							</tr>
                            <tr class='fo_cat_title_cont'>
								<td style="width: 18%; text-align: left;"><label><?php 
echo __('Perpustakaan');
?>
</label></td>
								<td style="width: 2%; text-align:center;">:</td> 
                                <td style="width: 80%; text-align: left;">
                                <?php 
$c = new Criteria();
$c->add(VCatalogPerDeptPeer::CATALOG_ID, $catalog->getId());
$location = VCatalogPerDeptPeer::doSelectOne($c);
echo $location->getDepartment() ? $location->getDepartment()->toString() : '-';
?>
                                </td>
							</tr>    
                        </table>
                    </td>
                </tr>
			</tbody>
		</table>
    </td>
  </tr>
</table>
Exemple #2
0
 public function getVCatalogPerDeptsJoinDepartment($criteria = null, $con = null)
 {
     include_once 'lib/model/om/BaseVCatalogPerDeptPeer.php';
     if ($criteria === null) {
         $criteria = new Criteria();
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collVCatalogPerDepts === null) {
         if ($this->isNew()) {
             $this->collVCatalogPerDepts = array();
         } else {
             $criteria->add(VCatalogPerDeptPeer::CATALOG_ID, $this->getId());
             $this->collVCatalogPerDepts = VCatalogPerDeptPeer::doSelectJoinDepartment($criteria, $con);
         }
     } else {
         $criteria->add(VCatalogPerDeptPeer::CATALOG_ID, $this->getId());
         if (!isset($this->lastVCatalogPerDeptCriteria) || !$this->lastVCatalogPerDeptCriteria->equals($criteria)) {
             $this->collVCatalogPerDepts = VCatalogPerDeptPeer::doSelectJoinDepartment($criteria, $con);
         }
     }
     $this->lastVCatalogPerDeptCriteria = $criteria;
     return $this->collVCatalogPerDepts;
 }
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = VCatalogPerDeptPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setCatalogId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setCatCategoryId($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setDepartmentId($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setTotalColItem($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setColLocationId($arr[$keys[4]]);
     }
 }
 public static function retrieveByPK($catalog_id, $cat_category_id, $department_id, $col_location_id, $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(self::DATABASE_NAME);
     }
     $criteria = new Criteria();
     $criteria->add(VCatalogPerDeptPeer::CATALOG_ID, $catalog_id);
     $criteria->add(VCatalogPerDeptPeer::CAT_CATEGORY_ID, $cat_category_id);
     $criteria->add(VCatalogPerDeptPeer::DEPARTMENT_ID, $department_id);
     $criteria->add(VCatalogPerDeptPeer::COL_LOCATION_ID, $col_location_id);
     $v = VCatalogPerDeptPeer::doSelect($criteria, $con);
     return !empty($v) ? $v[0] : null;
 }
Exemple #5
0
 public function filterPerDept($c, $filters)
 {
     $filters_key = array_keys($filters);
     foreach ($filters_key as $key) {
         $value = $filters[$key];
         if ($value == '' || $value == null) {
             continue;
         }
         if ($key == 'writer_id') {
             $c->addJoin(VCatalogPerDeptPeer::CATALOG_ID, CatalogPeer::ID);
             $c->addJoin(CatalogWriterPeer::CATALOG_ID, CatalogPeer::ID);
             $column = CatalogWriterPeer::getTableMap()->getColumn('WRITER_ID');
         } elseif ($key == 'code') {
             $c->addJoin(VCatalogPerDeptPeer::CATALOG_ID, CatalogPeer::ID);
             $column = CatalogPeer::getTableMap()->getColumn('CODE');
         } elseif ($key == 'published_year') {
             $c->addJoin(VCatalogPerDeptPeer::CATALOG_ID, CatalogPeer::ID);
             $column = CatalogPeer::getTableMap()->getColumn('PUBLISHED_YEAR');
         } elseif ($key == 'title') {
             $c->addJoin(VCatalogPerDeptPeer::CATALOG_ID, CatalogPeer::ID);
             $column = CatalogPeer::getTableMap()->getColumn('TITLE');
         } elseif ($key == 'cat_category_id') {
             $c->addJoin(VCatalogPerDeptPeer::CATALOG_ID, CatalogPeer::ID);
             $column = CatalogPeer::getTableMap()->getColumn('CAT_CATEGORY_ID');
         } elseif ($key == 'publisher_id') {
             $c->addJoin(VCatalogPerDeptPeer::CATALOG_ID, CatalogPeer::ID);
             $column = CatalogPeer::getTableMap()->getColumn('PUBLISHER_ID');
         } elseif ($key == 'writer') {
             $c->addJoin(VCatalogPerDeptPeer::CATALOG_ID, CatalogPeer::ID);
             $c->addJoin(CatalogWriterPeer::CATALOG_ID, CatalogPeer::ID);
             $c->addJoin(WriterPeer::ID, CatalogWriterPeer::WRITER_ID);
             $column = WriterPeer::getTableMap()->getColumn('NAME');
         } elseif ($key == 'publisher') {
             $c->addJoin(VCatalogPerDeptPeer::CATALOG_ID, CatalogPeer::ID);
             $c->addJoin(PublisherPeer::ID, CatalogPeer::PUBLISHER_ID);
             $column = PublisherPeer::getTableMap()->getColumn('NAME');
         } elseif ($key == 'department_id') {
             #if ($filters[$key] == 1) {
             $c->addJoin(VCatalogPerDeptPeer::CATALOG_ID, CatalogPeer::ID);
             $c->addJoin(DepartmentPeer::ID, VCatalogPerDeptPeer::DEPARTMENT_ID);
             $column = DepartmentPeer::getTableMap()->getColumn('ID');
             #} else {
             #	$c->addJoin(VCatalogPerDeptPeer::CATALOG_ID, CatalogPeer::ID);
             #	$c->addJoin(DepartmentPeer::ID, VCatalogPerDeptPeer::DEPARTMENT_ID);
             #	$c->addJoin(VDepartmentPeer::ID, DepartmentPeer::PARENT);
             #	$column = VDepartmentPeer::getTableMap()->getColumn('ID');
             #}
         } else {
             $column = VCatalogPerDeptPeer::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);
                     }
                 }
             }
         }
     }
 }