public static function get_instance() { if (!self::$_instance) { self::$_instance = new self(); } return self::$_instance; }
private function _save() { $pid = intval($this->_param['pid']); $pattern = trim($this->_param['pattern']); $pattern = explode("\n", $pattern); $biz = Biz_Exclude::get_instance(); $biz->delete_exclude($pid); foreach ($pattern as $p) { $biz->insert_exclude($pid, trim($p)); } $this->_response->redirect(PageHelper::get_domain() . "/project/op?pid={$pid}"); }
public function insert($p) { $project = new Model_Project(); $project->name = $p['name']; $project->name_prefix = $p['name_prefix']; $project->repository = $p['repository']; $project->is_fixed = $p['is_fixed']; $project->host_path = $p['host_path']; $project->version_file = $p['version_file']; $project->creation = date('Y-m-d H:i:s', time()); $project->save(); foreach ($p['host'] as $h) { $host = new Model_Host(); $host->pid = $project->id; $host->hostname = $h; $host->save(); } Biz_Exclude::get_instance()->insert_default_exclude($project->id); return $project->id; }