コード例 #1
0
 function create($stationName, $desc)
 {
     $this->set('name', $stationName);
     $this->set('description', $desc);
     parent::create();
     //return $this->id;
 }
コード例 #2
0
 function create($name)
 {
     global $nodeId;
     #$name = sotf_Utils::magicQuotes(/*$nodeId . '_' . */ $name);
     #$count = $this->db->getOne("SELECT count(*) FROM sotf_contacts WHERE name = '$name'");
     #if($count > 0)
     #  return ERROR_NAME_USED;
     $this->data['name'] = $name;
     return parent::create();
 }
コード例 #3
0
 function create($name)
 {
     global $config;
     $id = $this->findByNameLocal($name);
     if ($id) {
         debug("Create contact", "Failed, name in use");
         return false;
     }
     $this->data['name'] = $name;
     return parent::create();
 }
コード例 #4
0
 function create($stationName, $desc)
 {
     global $config;
     $this->set('name', $stationName);
     $this->set('description', $desc);
     parent::create();
     $dir = $this->getDir();
     if (!is_dir($dir)) {
         mkdir($dir, 0775);
         mkdir("{$dir}/station", 0775);
     }
     #return $this->id;
 }
コード例 #5
0
 function create($stationOrSeriesId, $track = '')
 {
     global $db, $repository;
     $db->begin();
     // TODO may need some locking to get unique track id
     $container =& $repository->getObject($stationOrSeriesId);
     // echo get_class($container);
     switch (strtolower(get_class($container))) {
         case 'sotf_series':
             $this->set('series_id', $container->id);
             $station = $container->getStation();
             $this->set('station_id', $station->id);
             $stationName = $station->get('name');
             break;
         case 'sotf_station':
             $this->set('station_id', $container->id);
             $stationName = $container->get('name');
             break;
         default:
             raiseError("Invalid station or series id!");
     }
     if (empty($stationName)) {
         raiseError("station does not exist");
     }
     if (empty($track)) {
         $track = 'prg';
     }
     $this->getStation();
     $this->set('entry_date', date('Y-m-d'));
     $this->set('modify_date', date('Y-m-d'));
     $this->set('track', sotf_Utils::makeValidName($track, 32));
     $this->getNextAvailableTrackId();
     // guid is obsolete, but anyway:
     $this->set('guid', $this->station->id . GUID_DELIMITER . $this->get('entry_date') . GUID_DELIMITER . $this->get('track'));
     if (parent::create()) {
         debug("created new programme", $this->id);
         $db->commit();
         return true;
     }
     $db->rollback();
     raiseError("Could not create new programme");
 }