本文整理汇总了PHP中Monitor::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Monitor::model方法的具体用法?PHP Monitor::model怎么用?PHP Monitor::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Monitor
的用法示例。
在下文中一共展示了Monitor::model方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetMonitorOptions
public function testGetMonitorOptions()
{
$monitors = Monitor::model()->getMonitorOptions();
$this->assertTrue(3 === count($monitors));
$this->assertTrue(is_array($monitors));
$this->assertTrue(in_array('monitor1', $monitors));
$this->assertFalse(in_array('monitor4', $monitors));
}
示例2: actionSort
public function actionSort()
{
$return = array('sukses' => false);
if (isset($_POST['mon'])) {
Monitor::model()->updateOrder($_POST['mon']);
$return = array('sukses' => true);
}
$this->renderJSON($return);
}
示例3: actionMonitorDetail
public function actionMonitorDetail($id, $serverId)
{
$namaTabel = "{$serverId}_{$id}";
$model = new MonitorDetail($namaTabel);
$model->scenario = 'search';
$monitor = Monitor::model()->findByPk($id);
$server = Server::model()->findByPk($serverId);
$this->render('monitor_detail', ['model' => $model, 'server' => $server, 'monitor' => $monitor]);
}
示例4: run
public function run()
{
$servers = ServerMonitor::model()->ambilServers($this->monitorId);
$monitor = Monitor::model()->findByPk($this->monitorId);
$tipeOutput = $monitor->outputType->nama;
$tipeView = $monitor->viewType->nama;
switch ($tipeView) {
case 'linechart':
$view = 'boxMonitorLineChart';
break;
case 'onoffstatus':
$view = 'boxMonitorOnOffStatus';
break;
case 'text':
$view = 'boxMonitorText';
break;
}
$this->render($view, array('title' => $this->title, 'monitorId' => $this->monitorId, 'servers' => $servers, 'tipeOutput' => $tipeOutput));
}
示例5: loadModel
/**
* Returns the data model based on the primary key given in the GET variable.
* If the data model is not found, an HTTP exception will be raised.
* @param integer $id the ID of the model to be loaded
* @return Monitor the loaded model
* @throws CHttpException
*/
public function loadModel($id)
{
$model = Monitor::model()->findByPk($id);
if ($model === null) {
throw new CHttpException(404, 'The requested page does not exist.');
}
return $model;
}
示例6: updateOrder
public function updateOrder($listIds)
{
$order = 0;
foreach ($listIds as $listId) {
Monitor::model()->updateByPk($listId, array('order' => $order));
$order++;
}
}
示例7: array
?>
<?php
echo $form->dropDownListGroup($weather, 'code', array('wrapperHtmlOptions' => array('class' => 'col-sm-5'), 'widgetOptions' => array('data' => Weather::model()->getWeatherOptions(), 'htmlOptions' => array())));
?>
<?php
echo $form->dropDownListGroup($theme, 'id', array('wrapperHtmlOptions' => array('class' => 'col-sm-5'), 'widgetOptions' => array('data' => $model->getThemeOptions(), 'htmlOptions' => array())));
?>
<?php
echo $form->dropDownListGroup($commercial, 'id', array('wrapperHtmlOptions' => array('class' => 'col-sm-5'), 'widgetOptions' => array('data' => Commercial::model()->getCommercialOptions(), 'htmlOptions' => array())));
?>
<?php
echo $form->dropDownListGroup($model, 'monitor_id', array('wrapperHtmlOptions' => array('class' => 'col-sm-5'), 'widgetOptions' => array('data' => Monitor::model()->getMonitorOptions(), 'htmlOptions' => array())));
?>
<?php
echo $form->dropDownListGroup($model, 'dongle_id', array('wrapperHtmlOptions' => array('class' => 'col-sm-5'), 'widgetOptions' => array('data' => Dongle::model()->getDongleOptions(), 'htmlOptions' => array())));
?>
<?php
echo $form->dropDownListGroup($model, 'yeshuv_id', array('wrapperHtmlOptions' => array('class' => 'col-sm-5'), 'widgetOptions' => array('data' => Yeshuv::model()->getYeshuvOptions(), 'htmlOptions' => array())));
?>
<?php
echo $form->textFieldGroup($model, 'url', array('wrapperHtmlOptions' => array('class' => 'col-sm-5', 'dir' => 'ltr')));
?>
示例8: getMonitorOptions
public function getMonitorOptions()
{
return CHtml::listData(Monitor::model()->findAll(array('order' => 'name')), 'id', 'name');
}
示例9: getNamaMonitor
public function getNamaMonitor()
{
$monitor = Monitor::model()->findByPk($this->monitor_id);
return $monitor->nama;
}
示例10: actionLoadServer
public function actionLoadServer()
{
if (!empty($_POST['Notifikasi']['monitor_id']) || $_POST['Notifikasi']['monitor_id'] == '0') {
$monitorId = $_POST['Notifikasi']['monitor_id'];
if ($monitorId == 0) {
/* Untuk uptime monitor, tampilkan semua server */
$servers = CHtml::listData(Server::model()->findAll(array('select' => 'id, nama', 'order' => 'nama')), 'id', 'nama');
foreach ($servers as $id => $nama) {
echo CHtml::tag('option', array('value' => $id), CHtml::encode($nama), true);
}
} else {
$monitor = Monitor::model()->findByPk($monitorId);
$servers = $monitor->listServerAktif();
foreach ($servers as $server) {
echo CHtml::tag('option', array('value' => $server['id']), CHtml::encode($server['nama']), true);
}
}
} else {
echo CHtml::tag('option', array('value' => ''), CHtml::encode('Pilih monitor..'), true);
}
}
示例11: getInfo
public function getInfo()
{
/* Items allocated*/
$commodity['consumable'] = Consumable::model()->findAll();
$commodity['monitor'] = Monitor::model()->findAll();
$commodity['printers'] = Printers::model()->findAll();
$commodity['devices'] = Devices::model()->findAll();
$dup = $commodity;
/* Items available on Loan*/
$availableOnLoan = 0;
$thresholdItems = 0;
$content = '';
foreach ($commodity as $key => $commo) {
foreach ($commo as $item) {
if ($item['available_on_loan'] == 1 || $item['available_on_loan'] == 'Yes') {
++$availableOnLoan;
}
if ($key == 'consumable') {
$commodity = Commodity::model()->findByAttributes(array('name' => $key));
$allocates = Allocate::model()->findAllByAttributes(array('commodity_id' => $commodity['id'], 'cons_id' => $item['id']));
if (count($allocates) < $item['threshold']) {
++$thresholdItems;
}
}
}
}
/** Allocated and unallocated **/
$countAllocated = 0;
$countUnAllocated = 0;
$commodity = $dup;
$unAllocated = Allocate::model()->findAllByAttributes(array('date_out' => NULL));
$allocated = Allocate::model()->findAll('date_out IS NOT NULL');
$countAllocated += count($allocated);
$countUnAllocated += count($unAllocated);
$content .= '<b style="color:red">' . $availableOnLoan . '</b> item available on loan<br/>';
$content .= '<b style="color:red">' . $thresholdItems . '</b> item below threshold<br/>';
$content .= '<b style="color:red">' . $countAllocated . '</b> item allocated<br/>';
$content .= '<b style="color:red">' . $countUnAllocated . '</b> item unallocated<br/>';
/* Items below threshold*/
return $content;
}
示例12: array
<div class="col-md-6">
<?php
echo $form->textFieldGroup($migracion, 'disco_despues', array('wrapperHtmlOptions' => array('class' => 'col-sm-5')));
?>
</div>
<div class="col-md-6">
<?php
echo $form->dropDownListGroup($migracion, 'cpu_id_despues', array('wrapperHtmlOptions' => array('class' => 'col-sm-5'), 'widgetOptions' => array('data' => CHtml::listData(Cpu::model()->findAll(), 'id', 'procesador', 'marca'), 'htmlOptions' => array('prompt' => 'Seleccione Cpu'))));
?>
</div>
<div class="col-md-6">
<?php
echo $form->dropDownListGroup($migracion, 'monitor_id_despues', array('wrapperHtmlOptions' => array('class' => 'col-sm-5'), 'widgetOptions' => array('data' => CHtml::listData(Monitor::model()->findAll(), 'id', 'modelo', 'marca'), 'htmlOptions' => array('prompt' => 'Seleccione Monitor'))));
?>
</div>
</div>
</div>
</div>
<?php
}
?>
<!-- FIN MIGRACION-->
<?php
}
?>
示例13: installMonitor
public function installMonitor()
{
$monitor = Monitor::model()->findByPk($this->monitor_id);
$resultTableDef = $monitor->outputType->table_def;
$transaction = $this->dbConnection->beginTransaction();
try {
if ($this->save()) {
Yii::app()->db->createCommand()->createTable($this->getResultTableName(), array('id' => 'bigint(20) unsigned NOT NULL AUTO_INCREMENT', 'result' => $resultTableDef, 'waktu' => 'timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP', 'keterangan' => 'varchar(512) DEFAULT NULL', 'PRIMARY KEY (`id`)'), 'ENGINE=MyISAM DEFAULT CHARSET=utf8');
$transaction->commit();
return true;
} else {
throw new Exception("Gagal Install Monitor");
}
} catch (Exception $e) {
$transaction->rollback();
throw $e;
}
}