Exemple #1
0
 private function _getListAction($path)
 {
     $xml = new SimpleXMLElement("<sensors></sensors>");
     @($p_page = DevblocksPlatform::importGPC($_REQUEST['p'], 'integer', 0));
     list($sensors, $null) = DAO_Sensor::search(array(), array(), 50, $p_page, SearchFields_Sensor::NAME, true, false);
     $this->_renderResults($sensors, SearchFields_Sensor::getFields(), 'sensor', 'sensors');
 }
Exemple #2
0
 function doBulkUpdate($filter, $do, $ids = array())
 {
     @set_time_limit(600);
     // [TODO] Temp!
     $change_fields = array();
     $custom_fields = array();
     if (empty($do)) {
         return;
     }
     if (is_array($do)) {
         foreach ($do as $k => $v) {
             switch ($k) {
                 //				case 'is_disabled':
                 //					$change_fields[DAO_Sensor::IS_DISABLED] = intval($v);
                 //					break;
                 default:
                     // Custom fields
                     if (substr($k, 0, 3) == "cf_") {
                         $custom_fields[substr($k, 3)] = $v;
                     }
                     break;
             }
         }
     }
     $pg = 0;
     if (empty($ids)) {
         do {
             list($objects, $null) = DAO_Sensor::search(array(), $this->params, 100, $pg++, SearchFields_Sensor::ID, true, false);
             $ids = array_merge($ids, array_keys($objects));
         } while (!empty($objects));
     }
     $batch_total = count($ids);
     for ($x = 0; $x <= $batch_total; $x += 100) {
         $batch_ids = array_slice($ids, $x, 100);
         DAO_Sensor::update($batch_ids, $change_fields);
         // Custom Fields
         self::_doBulkSetCustomFields(PsCustomFieldSource_Sensor::ID, $custom_fields, $batch_ids);
         unset($batch_ids);
     }
     unset($ids);
 }