本文整理汇总了PHP中Monitor::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Monitor::save方法的具体用法?PHP Monitor::save怎么用?PHP Monitor::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Monitor
的用法示例。
在下文中一共展示了Monitor::save方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionTambah
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'ubah' page.
*/
public function actionTambah()
{
$model = new UploadMonitorForm();
$monitor = new Monitor();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['UploadMonitorForm'])) {
$scriptFile = CUploadedFile::getInstanceByName('UploadMonitorForm[nama_file]');
if (isset($scriptFile)) {
$ini_array = parse_ini_file($scriptFile->tempName, true);
// echo "Nama: {$ini_array['description']['name']} <br />";
// echo "Descripsi: {$ini_array['description']['description']} <br />";
// echo "Perintah: {$ini_array['config']['command']} <br />";
// echo "Output: {$ini_array['config']['output']} <br />";
// echo "View: {$ini_array['config']['view']}";
//$monitor = new Monitor;
$monitor->nama = $ini_array['description']['name'];
$monitor->deskripsi = $ini_array['description']['description'];
$monitor->perintah = $ini_array['config']['command'];
$monitor->output_type_id = OutputType::model()->find("nama = '{$ini_array['config']['output']}'")->id;
$monitor->view_type_id = isset($ini_array['config']['view']) ? ViewType::model()->find("nama = '{$ini_array['config']['view']}'")->id : NULL;
$monitor->prefix = isset($ini_array['config']['prefix']) ? $ini_array['config']['prefix'] : NULL;
$monitor->suffix = isset($ini_array['config']['suffix']) ? $ini_array['config']['suffix'] : NULL;
if ($monitor->save()) {
$this->redirect(array('ubah', 'id' => $monitor->id));
}
}
}
$this->render('tambah', array('model' => $model, 'monitor' => $monitor));
}
示例2: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model = new Monitor();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['Monitor'])) {
$model->attributes = $_POST['Monitor'];
if ($model->save()) {
$this->redirect(array('admin'));
}
}
$this->render('create', array('model' => $model));
}
示例3: testCreate
public function testCreate()
{
$this->object->name = "Monitor 6";
$this->object->size = 7;
$this->assertTrue($this->object->save(FALSE));
}