<td style="vertical-align: top;"><label><?php echo 'Upload Cover Video'; ?> </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(CatalogVideoPeer::CATALOG_ID, $catalog->getId()); $files = CatalogVideoPeer::doSelect($c); $count = CatalogVideoPeer::doCount($c); if ($files) { $file_dir = sfConfig::get('sf_data_dir') . DIRECTORY_SEPARATOR . 'video'; $i = 0; foreach ($files as $file) { ++$i; echo $i . '. ' . $file->getCover() . ' '; echo link_to_remote(image_tag('delete.gif', 'title=Hapus File Upload'), array('url' => 'collection/deleteVideo?id=' . $file->getId() . '&catalog_id=' . $catalog->getId(), 'confirm' => __('Are you sure?'), 'update' => 'content', 'script' => 'true')) . '<br>'; } } ?> </p> <?php } ?>
public static function retrieveByPK($id, $catalog_id, $con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } $criteria = new Criteria(); $criteria->add(CatalogVideoPeer::ID, $id); $criteria->add(CatalogVideoPeer::CATALOG_ID, $catalog_id); $v = CatalogVideoPeer::doSelect($criteria, $con); return !empty($v) ? $v[0] : null; }
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = CatalogVideoPeer::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->setVideo($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setCover($arr[$keys[3]]); } }
public function executeDeleteVideo() { $cat_video = CatalogVideoPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($cat_video); $tmp_dir = sfConfig::get('sf_root_dir') . DIRECTORY_SEPARATOR . 'muslim' . DIRECTORY_SEPARATOR . 'video' . DIRECTORY_SEPARATOR; unlink($tmp_dir . DIRECTORY_SEPARATOR . $cat_video->getVideo()); $cat_video->delete(); return $this->redirect('collection/edit?id=' . $this->getRequestParameter('catalog_id')); }