本文整理汇总了PHP中Program::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Program::save方法的具体用法?PHP Program::save怎么用?PHP Program::save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Program
的用法示例。
在下文中一共展示了Program::save方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionCreate
public function actionCreate()
{
$model = new Program();
if (isset($_POST['Program'])) {
$model->setAttributes($_POST['Program']);
if ($model->save()) {
if (Yii::app()->getRequest()->getIsAjaxRequest()) {
Yii::app()->end();
} else {
$this->redirect(array('view', 'id' => $model->id));
}
}
}
$this->render('create', array('model' => $model));
}
示例2: store
public function store()
{
$daterange = explode('-', Input::get('range'));
$start_date = trim($daterange[0]);
$end_date = trim($daterange[1]);
$program = new Program();
$program->project_id = Auth::user()->curr_project_id;
$program->location_id = Auth::user()->location_id;
$program->name = Input::get('name');
$program->description = Input::get('description');
$program->start_date = date('Y-m-d', strtotime($start_date));
$program->end_date = date('Y-m-d', strtotime($end_date));
$program->save();
Session::flash('message', 'Sukses membuka program baru!');
}
示例3: postProgram
public function postProgram()
{
$validator = Validator::make(Input::all(), Program::$rules);
if ($validator->passes()) {
$program = new Program();
$program->name = Input::get('name');
$program->category_id = Input::get('category_id');
$program->classification = Input::get('classification');
$program->audience_id = Input::get('audience_id');
$program->language_id = Input::get('language_id');
$program->save();
return Response::json($program);
} else {
return 0;
}
}
示例4: store
/**
* Store a newly created resource in storage.
* POST /program
*
* @return Response
*/
public function store()
{
//get current club
$user = Auth::user();
$club = $user->Clubs()->FirstOrFail();
$uuid = Uuid::generate();
$validator = Validator::make(Input::all(), Program::$rules);
if ($validator->passes()) {
$program = new Program();
$program->id = $uuid;
$program->name = Input::get('name');
$program->club_id = $club->id;
$program->user_id = $user->id;
$program->description = Input::get('description');
$status = $program->save();
if ($status) {
return Redirect::action('ProgramController@index')->with('messages', 'Program created successfully');
}
}
$error = $validator->errors()->all(':message');
return Redirect::action('ProgramController@create')->withErrors($validator)->withInput();
}
示例5: actionInsertProgram
public function actionInsertProgram()
{
Yii::app()->user->returnUrl = Yii::app()->request->urlReferrer;
if ($_POST) {
// $cek = DatabaseUmum::cekExist("program","nama_program",$_POST['namaTP']); // cek menggunakan component DatabaseUmum
$cek = DatabaseUmum::cekExist2('program', 'nama_program', 'tahun_anggaran', $_POST['namaTP'], $_POST['tahunTP']);
if ($cek <= 0) {
$program = new Program();
$program->nama_program = $_POST['namaTP'];
$program->kode_program = $_POST['kodeTP'];
$program->target = $_POST['targetTP'];
$program->tahun_anggaran = $_POST['tahunTP'];
$program->id_rekaman = 0;
if ($program->validate()) {
$program->save();
// echo $program->nama_program;
$this->redirect(array('index'));
} else {
Yii::app()->user->setFlash('error', 'Maaf, simpan Program gagal. Mohon periksa kembali data yang anda inputkan');
$this->redirect(array('/errPage/errDB'));
}
} else {
Yii::app()->user->setFlash('error', 'Maaf, simpan Program gagal. Data sudah ada');
$this->redirect(array('/errPage/errDB'));
}
} else {
$this->actionIndex();
}
}