public static function retrieveByCode($code, $con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } $criteria = new Criteria(ClassAgendaFilePeer::DATABASE_NAME); $criteria->add(ClassAgendaFilePeer::ID, $code); $v = ClassAgendaFilePeer::doSelect($criteria, $con); return !empty($v) > 0 ? $v[0] : null; }
?> </p></td> </tr> <tr> <td style="vertical-align:middle;"><label ><?php echo __('File Upload'); ?> </label></td> <td width="2%" style="text-align:center; vertical-align:middle;">:</td> <td style="vertical-align:middle;"> <p class="detail"> <?php $c = new Criteria(); $c->add(ClassAgendaFilePeer::CLASS_AGENDA_ID, $class_agenda->getId()); $file = ClassAgendaFilePeer::doSelect($c); $count = ClassAgendaFilePeer::doCount($c); if ($file == null) { echo ' -'; } else { $file_dir = sfConfig::get('sf_data_dir') . DIRECTORY_SEPARATOR . 'files'; if ($count == 2) { echo ' 1. '; echo link_to($file[0]->getFile(), 'class_agenda/download?filename=' . $file[0]->getFile(), 'target=_blank') . '<br>'; echo ' 2. '; echo link_to($file[1]->getFile(), 'class_agenda/download?filename=' . $file[1]->getFile(), 'target=_blank'); } elseif ($count == 3) { echo ' 1. '; echo link_to($file[0]->getFile(), 'class_agenda/download?filename=' . $file[0]->getFile(), 'target=_blank') . '<br>'; echo ' 2. '; echo link_to($file[1]->getFile(), 'class_agenda/download?filename=' . $file[1]->getFile(), 'target=_blank') . '<br>';
public static function retrieveByPK($id, $class_agenda_id, $con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } $criteria = new Criteria(); $criteria->add(ClassAgendaFilePeer::ID, $id); $criteria->add(ClassAgendaFilePeer::CLASS_AGENDA_ID, $class_agenda_id); $v = ClassAgendaFilePeer::doSelect($criteria, $con); return !empty($v) ? $v[0] : null; }
public function getClassAgendaFiles($criteria = null, $con = null) { include_once 'lib/model/om/BaseClassAgendaFilePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collClassAgendaFiles === null) { if ($this->isNew()) { $this->collClassAgendaFiles = array(); } else { $criteria->add(ClassAgendaFilePeer::CLASS_AGENDA_ID, $this->getId()); ClassAgendaFilePeer::addSelectColumns($criteria); $this->collClassAgendaFiles = ClassAgendaFilePeer::doSelect($criteria, $con); } } else { if (!$this->isNew()) { $criteria->add(ClassAgendaFilePeer::CLASS_AGENDA_ID, $this->getId()); ClassAgendaFilePeer::addSelectColumns($criteria); if (!isset($this->lastClassAgendaFileCriteria) || !$this->lastClassAgendaFileCriteria->equals($criteria)) { $this->collClassAgendaFiles = ClassAgendaFilePeer::doSelect($criteria, $con); } } } $this->lastClassAgendaFileCriteria = $criteria; return $this->collClassAgendaFiles; }