private function _getListAction($path) { @($p_page = DevblocksPlatform::importGPC($_REQUEST['p'], 'integer', 0)); list($orgs, $null) = DAO_ContactOrg::search(array(), array(), 50, $p_page, SearchFields_ContactOrg::NAME, true, false); $this->_renderResults($orgs, SearchFields_ContactOrg::getFields(), 'org', 'orgs'); }
function getOrgsAutoCompletionsAction() { @($starts_with = DevblocksPlatform::importGPC($_REQUEST['q'], 'string', '')); $params = array(DAO_ContactOrg::NAME => $starts_with); list($orgs, $null) = DAO_ContactOrg::search(array(), array(new DevblocksSearchCriteria(SearchFields_ContactOrg::NAME, DevblocksSearchCriteria::OPER_LIKE, $starts_with . '*')), -1, 0, SearchFields_ContactOrg::NAME, true, false); foreach ($orgs as $val) { echo $val[SearchFields_ContactOrg::NAME] . "|"; echo $val[SearchFields_ContactOrg::ID] . "\n"; } exit; }
function doBulkUpdate($filter, $do, $ids = array()) { @set_time_limit(0); $change_fields = array(); $custom_fields = array(); // Make sure we have actions if (empty($do)) { return; } // Make sure we have checked items if we want a checked list if (0 == strcasecmp($filter, "checks") && empty($ids)) { return; } if (is_array($do)) { foreach ($do as $k => $v) { switch ($k) { case 'country': $change_fields[DAO_ContactOrg::COUNTRY] = $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_ContactOrg::search(array(), $this->params, 100, $pg++, SearchFields_ContactOrg::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_ContactOrg::update($batch_ids, $change_fields); // Custom Fields self::_doBulkSetCustomFields(ChCustomFieldSource_Org::ID, $custom_fields, $batch_ids); unset($batch_ids); } unset($ids); }