예제 #1
0
 private function get_section($department)
 {
     $sectionCriteria = new Criteria();
     $sectionCriteria->add(WebSectionPeer::DEPARTMENT_ID, $department, Criteria::EQUAL);
     $section = WebSectionPeer::doSelectOne($sectionCriteria);
     return $section;
 }
예제 #2
0
function getTitle($module)
{
    $criteria = new Criteria();
    $criteria->add(WebSectionPeer::INITIAL, $module, Criteria::EQUAL);
    $section = WebSectionPeer::doSelectOne($criteria);
    if (!$section) {
        return 'unknown title';
    }
    return $section->getName();
}
예제 #3
0
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = WebSectionPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setName($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setInitial($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setDepartmentId($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setDescription($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setCreated($arr[$keys[5]]);
     }
     if (array_key_exists($keys[6], $arr)) {
         $this->setPublished($arr[$keys[6]]);
     }
 }
예제 #4
0
 public function getDepartmentByInitial($initial)
 {
     $criteria = new Criteria();
     $criteria->add(WebSectionPeer::INITIAL, $initial, Criteria::EQUAL);
     return WebSectionPeer::doSelectOne($criteria);
 }
예제 #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(WebSectionPeer::ID, $pks, Criteria::IN);
         $objs = WebSectionPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
예제 #6
0
 public function publish($param)
 {
     $section = WebSectionPeer::retrieveByPK($param['id']);
     if (!$section) {
         $this->jsonwrapper->show_json_error('section', 'section not found');
     }
     if ($section->getPublished() == 1) {
         $section->setPublished(0);
     } else {
         $section->setPublished(1);
     }
     $section->save();
     $output = array('success' => 1, 'message' => 'Success', 'data' => $section->toArray());
     $this->jsonwrapper->print_json($output);
 }