Exemplo n.º 1
0
 public function getCatalogFilesJoinFile($criteria = null, $con = null)
 {
     include_once 'lib/model/om/BaseCatalogFilePeer.php';
     if ($criteria === null) {
         $criteria = new Criteria();
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collCatalogFiles === null) {
         if ($this->isNew()) {
             $this->collCatalogFiles = array();
         } else {
             $criteria->add(CatalogFilePeer::CATALOG_ID, $this->getId());
             $this->collCatalogFiles = CatalogFilePeer::doSelectJoinFile($criteria, $con);
         }
     } else {
         $criteria->add(CatalogFilePeer::CATALOG_ID, $this->getId());
         if (!isset($this->lastCatalogFileCriteria) || !$this->lastCatalogFileCriteria->equals($criteria)) {
             $this->collCatalogFiles = CatalogFilePeer::doSelectJoinFile($criteria, $con);
         }
     }
     $this->lastCatalogFileCriteria = $criteria;
     return $this->collCatalogFiles;
 }
Exemplo n.º 2
0
?>
</label></td>
								<td style="width: 2%; text-align:center; vertical-align:top">:</td> 
                                <td style="width: 80%; text-align: justify;">
								<?php 
$syn = $catalog->getSynopsis();
$syn = str_replace("\n", "<br/>", $syn);
echo $syn;
?>
								</td>
							</tr>
                            <?php 
$c = new Criteria();
$c->add(CatalogFilePeer::CATALOG_ID, $catalog->getId());
$count = CatalogFilePeer::doCount($c);
$file = CatalogFilePeer::doSelect($c);
?>
                            <?php 
if ($file != null) {
    ?>
 							<tr class='fo_cat_title_cont'>
								<td style="width: 18%; text-align: left; vertical-align: top;"><label><?php 
    echo __('File Digital');
    ?>
</label></td>
								<td style="width: 2%; text-align:center; vertical-align:top;">:</td> 
                                <td style="width: 80%; text-align: left;">
								 <?php 
    if ($count == 2) {
        ?>
									<?php 
Exemplo n.º 3
0
        <td style="vertical-align: top;"><label><?php 
echo 'Upload File';
?>
</label></td>
        <td style="text-align:center; vertical-align: top;">:</td>
        <td style="vertical-align: top;">
            <?php 
if (isset($catalog) && $catalog->getId()) {
    ?>
	
                <p class="detail" style="font-weight: bold;">
                    <?php 
    $c = new Criteria();
    $c->add(CatalogFilePeer::CATALOG_ID, $catalog->getId());
    $files = CatalogFilePeer::doSelect($c);
    $count = CatalogFilePeer::doCount($c);
    if ($files) {
        $file_dir = sfConfig::get('sf_data_dir') . DIRECTORY_SEPARATOR . 'files';
        $i = 0;
        foreach ($files as $file) {
            ++$i;
            echo $i . '.&nbsp;' . link_to($file->getFile(), 'collection/download?filename=' . $file->getFile(), 'target=_blank') . '&nbsp;&nbsp;';
            echo link_to_remote(image_tag('delete.gif', 'title=Hapus File Upload'), array('url' => 'collection/deleteFile?id=' . $file->getId() . '&catalog_id=' . $catalog->getId(), 'confirm' => __('Are you sure?'), 'update' => 'content', 'script' => 'true')) . '<br>';
        }
    }
    ?>
	
                </p>
                <?php 
}
?>
Exemplo n.º 4
0
 public function executeDeleteFile()
 {
     $cat_file = CatalogFilePeer::retrieveByPk($this->getRequestParameter('id'));
     $this->forward404Unless($cat_file);
     $cat_file->delete();
     return $this->redirect('catalog/edit?id=' . $this->getRequestParameter('catalog_id'));
 }
Exemplo n.º 5
0
 public static function retrieveByPKs($pks, $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(self::DATABASE_NAME);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria();
         $criteria->add(CatalogFilePeer::ID, $pks, Criteria::IN);
         $objs = CatalogFilePeer::doSelect($criteria, $con);
     }
     return $objs;
 }
Exemplo n.º 6
0
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = CatalogFilePeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setCatalogId($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setFile($arr[$keys[2]]);
     }
 }
Exemplo n.º 7
0
 public function executeDeleteFile()
 {
     $cat_file = CatalogFilePeer::retrieveByPk($this->getRequestParameter('id'));
     $this->forward404Unless($cat_file);
     $tmp_dir = sfConfig::get('sf_data_dir') . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR;
     unlink($tmp_dir . DIRECTORY_SEPARATOR . $cat_file->getFile());
     $cat_file->delete();
     return $this->redirect('collection/edit?id=' . $this->getRequestParameter('catalog_id'));
 }