This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Monitor extends AppModel { | |
public $useTable = 'Monitors'; | |
public $hasMany = array( | |
'Event' => array( | |
'className' => 'Event', | |
'foreignKey' => 'MonitorId' | |
), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Monitor extends AppModel { | |
public $useTable = 'Monitors'; | |
public $hasMany = array( | |
'Event' => array( | |
'className' => 'Event', | |
'foreignKey' => 'MonitorId' | |
), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Event extends AppModel { | |
public $useTable = 'Events'; | |
public $belongsTo = array( | |
'Monitor' => array( | |
'className' => 'Monitor', | |
'foreignKey' => 'MonitorId' | |
) | |
); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$monitor['Events']['Hour'] | |
$monitor['Events']['Day'] | |
$monitor['Events']['Week'] | |
$monitor['Events']['Month'] | |
$monitor['Events']['Archived'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h2>Configs</h2> | |
<?php | |
echo $this->Form->create('Config', array( | |
'url' => '/config/edit' | |
)); | |
foreach ($configs as $config): | |
$inputname = "Config."; | |
$inputname.= $config['Config']['Id']; | |
$inputname.= "."; | |
$inputname.= $config['Config']['Name']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h2>Configs</h2> | |
<?php | |
echo $this->Form->create('Config', array( | |
'url' => '/config/edit' | |
)); | |
foreach ($configs as $index => $config): | |
$inputname = 'Config.' . $index . '.' . $config['Config']['Name']; | |
echo $this->Form->input($inputname, array( | |
'default' => $config['Config']['Value'], | |
'label' => $config['Config']['Name'], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function edit() { | |
if (!empty($this->data)) { | |
foreach ($this->data['Config'] as $key => $value) { | |
foreach ($value as $fieldName => $fieldValue) { | |
$id = intval($key); | |
$this->Config->id = $id; | |
$this->Config->read(); // Removing this has no affect | |
$this->Config->saveField($fieldName, $fieldValue, array('validate' => false, 'callbacks' => false)); | |
$this->Config->create(); // Removing this has no affect | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
array( | |
'Config' => array( | |
(int) 25 => array( | |
'ZM_TIMESTAMP_ON_CAPTURE' => '1' | |
), | |
(int) 26 => array( | |
'ZM_CPU_EXTENSIONS' => '1' | |
), | |
(int) 27 => array( | |
'ZM_FAST_IMAGE_BLENDS' => '1' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
array( | |
(int) 0 => 'Id', | |
(int) 1 => 'Name', | |
(int) 2 => 'Value', | |
(int) 3 => 'Type', | |
(int) 4 => 'DefaultValue', | |
(int) 5 => 'Hint', | |
(int) 6 => 'Pattern', | |
(int) 7 => 'Format', | |
(int) 8 => 'Prompt', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mysql> SELECT IFNULL(COUNT(`Event`.`Id`), 0) AS count FROM `zm`.`Events` AS `Event` LEFT JOIN `zm`.`Monitors` AS `Monitor` ON (`Event`.`MonitorId` = `Monitor`.`Id`) WHERE `Event`.`StartTime` > DATE_SUB(NOW(), INTERVAL 1 DAY) GROUP BY `Event`.`MonitorId`; | |
+-------+ | |
| count | | |
+-------+ | |
| 16 | | |
| 27 | | |
+-------+ | |
2 rows in set (0.00 sec) | |
mysql> SELECT IFNULL(COUNT(`Event`.`Id`), 0) AS count FROM `zm`.`Events` AS `Event` LEFT JOIN `zm`.`Monitors` AS `Monitor` ON (`Event`.`MonitorId` = `Monitor`.`Id`) WHERE `Event`.`StartTime` > DATE_SUB(NOW(), INTERVAL 1 HOUR) GROUP BY `Event`.`MonitorId`; |