static function update($ids, $fields) { parent::_update($ids, 'worker_role', $fields); }
public static function update($ids, $fields) { parent::_update($ids, 'worker_mail_forward', $fields); }
/** * Enter description here... * * @param DevblocksSearchCriteria[] $params * @param integer $limit * @param integer $page * @param string $sortBy * @param boolean $sortAsc * @param boolean $withCounts * @return array */ static function search($params, $limit = 10, $page = 0, $sortBy = null, $sortAsc = null, $withCounts = true) { $db = DevblocksPlatform::getDatabaseService(); $fields = SearchFields_Translation::getFields(); // Sanitize if (!isset($fields[$sortBy])) { $sortBy = null; } list($tables, $wheres) = parent::_parseSearchParams($params, array(), $fields, $sortBy); $start = $page * $limit; // [JAS]: 1-based [TODO] clean up + document $select_sql = sprintf("SELECT " . "tl.id as %s, " . "tl.string_id as %s, " . "tl.lang_code as %s, " . "tl.string_default as %s, " . "tl.string_override as %s ", SearchFields_Translation::ID, SearchFields_Translation::STRING_ID, SearchFields_Translation::LANG_CODE, SearchFields_Translation::STRING_DEFAULT, SearchFields_Translation::STRING_OVERRIDE); $join_sql = "FROM translation tl "; // "LEFT JOIN contact_org o ON (o.id=a.contact_org_id) " // [JAS]: Dynamic table joins // (isset($tables['o']) ? "LEFT JOIN contact_org o ON (o.id=a.contact_org_id)" : " "). // (isset($tables['mc']) ? "INNER JOIN message_content mc ON (mc.message_id=m.id)" : " "). $where_sql = "" . (!empty($wheres) ? sprintf("WHERE %s ", implode(' AND ', $wheres)) : ""); $sql = $select_sql . $join_sql . $where_sql . (!empty($sortBy) ? sprintf("ORDER BY %s %s", $sortBy, $sortAsc || is_null($sortAsc) ? "ASC" : "DESC") : ""); $rs = $db->SelectLimit($sql, $limit, $start); /* @var $rs ADORecordSet */ $results = array(); if (is_a($rs, 'ADORecordSet')) { while (!$rs->EOF) { $result = array(); foreach ($rs->fields as $f => $v) { $result[$f] = $v; } $id = intval($rs->fields[SearchFields_Translation::ID]); $results[$id] = $result; $rs->MoveNext(); } } // [JAS]: Count all $total = -1; if ($withCounts) { $count_sql = "SELECT count(*) " . $join_sql . $where_sql; $total = $db->GetOne($count_sql); } return array($results, $total); }
/** * Enter description here... * * @param array $columns * @param DevblocksSearchCriteria[] $params * @param integer $limit * @param integer $page * @param string $sortBy * @param boolean $sortAsc * @param boolean $withCounts * @return array */ static function search($columns, $params, $limit = 10, $page = 0, $sortBy = null, $sortAsc = null, $withCounts = true) { $db = DevblocksPlatform::getDatabaseService(); $fields = SearchFields_Worklist::getFields(); // Sanitize if (!isset($fields[$sortBy])) { $sortBy = null; } list($tables, $wheres) = parent::_parseSearchParams($params, $columns, $fields, $sortBy); $start = $page * $limit; // [JAS]: 1-based $total = -1; $select_sql = sprintf("SELECT " . "worklist.id as %s, " . "worklist.worker_id as %s, " . "worklist.workspace as %s, " . "worklist.view_serialized as %s, " . "worklist.view_pos as %s, " . "worklist.source_extension as %s ", SearchFields_Worklist::ID, SearchFields_Worklist::WORKER_ID, SearchFields_Worklist::WORKSPACE, SearchFields_Worklist::VIEW_SERIALIZED, SearchFields_Worklist::VIEW_POS, SearchFields_Worklist::SOURCE_EXTENSION); $join_sql = "FROM worklist "; // Custom field joins //list($select_sql, $join_sql, $has_multiple_values) = self::_appendSelectJoinSqlForCustomFieldTables( // $tables, // $params, // 'worklist.id', // $select_sql, // $join_sql //); $where_sql = "" . (!empty($wheres) ? sprintf("WHERE %s ", implode(' AND ', $wheres)) : ""); $sort_sql = !empty($sortBy) ? sprintf("ORDER BY %s %s ", $sortBy, $sortAsc || is_null($sortAsc) ? "ASC" : "DESC") : " "; $sql = $select_sql . $join_sql . $where_sql . ($has_multiple_values ? 'GROUP BY worklist.id ' : '') . $sort_sql; // [TODO] Could push the select logic down a level too if ($limit > 0) { $rs = $db->SelectLimit($sql, $limit, $start) or die(__CLASS__ . '(' . __LINE__ . ')' . ':' . $db->ErrorMsg()); } else { $rs = $db->Execute($sql) or die(__CLASS__ . '(' . __LINE__ . ')' . ':' . $db->ErrorMsg()); $total = mysql_num_rows($rs); } $results = array(); while ($row = mysql_fetch_assoc($rs)) { $result = array(); foreach ($row as $f => $v) { $result[$f] = $v; } $object_id = intval($row[SearchFields_Worklist::ID]); $results[$object_id] = $result; } mysql_free_result($rs); // [JAS]: Count all if ($withCounts) { $count_sql = ($has_multiple_values ? "SELECT COUNT(DISTINCT worklist.id) " : "SELECT COUNT(worklist.id) ") . $join_sql . $where_sql; $total = $db->GetOne($count_sql); } return array($results, $total); }
/** * Enter description here... * * @param DevblocksSearchCriteria[] $params * @param integer $limit * @param integer $page * @param string $sortBy * @param boolean $sortAsc * @param boolean $withCounts * @return array */ static function search($params, $limit = 10, $page = 0, $sortBy = null, $sortAsc = null, $withCounts = true) { $db = DevblocksPlatform::getDatabaseService(); $fields = SearchFields_CommunityTool::getFields(); // Sanitize if (!isset($fields[$sortBy])) { $sortBy = null; } list($tables, $wheres) = parent::_parseSearchParams($params, array(), $fields, $sortBy); $start = $page * $limit; // [JAS]: 1-based [TODO] clean up + document $sql = sprintf("SELECT " . "ct.id as %s, " . "ct.name as %s, " . "ct.code as %s, " . "ct.community_id as %s, " . "ct.extension_id as %s " . "FROM community_tool ct ", SearchFields_CommunityTool::ID, SearchFields_CommunityTool::NAME, SearchFields_CommunityTool::CODE, SearchFields_CommunityTool::COMMUNITY_ID, SearchFields_CommunityTool::EXTENSION_ID) . (!empty($wheres) ? sprintf("WHERE %s ", implode(' AND ', $wheres)) : "") . (!empty($sortBy) ? sprintf("ORDER BY %s %s", $sortBy, $sortAsc || is_null($sortAsc) ? "ASC" : "DESC") : ""); $rs = $db->SelectLimit($sql, $limit, $start) or die(__CLASS__ . '(' . __LINE__ . ')' . ':' . $db->ErrorMsg()); /* @var $rs ADORecordSet */ $results = array(); if (is_a($rs, 'ADORecordSet')) { while (!$rs->EOF) { $result = array(); foreach ($rs->fields as $f => $v) { $result[$f] = $v; } $ticket_id = intval($rs->fields[SearchFields_CommunityTool::ID]); $results[$ticket_id] = $result; $rs->MoveNext(); } } // [JAS]: Count all $total = -1; if ($withCounts) { $rs = $db->Execute($sql); $total = $rs->RecordCount(); } return array($results, $total); }
static function update($ids, $fields) { parent::_update($ids, 'custom_field', $fields); self::clearCache(); }
static function update($ids, $fields) { parent::_update($ids, 'timetracking_activity', $fields); }
/** * Enter description here... * * @param DevblocksSearchCriteria[] $params * @param integer $limit * @param integer $page * @param string $sortBy * @param boolean $sortAsc * @param boolean $withCounts * @return array */ static function search($params, $limit = 10, $page = 0, $sortBy = null, $sortAsc = null, $withCounts = true) { $db = DevblocksPlatform::getDatabaseService(); $fields = SearchFields_TicketAuditLog::getFields(); // Sanitize if (!isset($fields[$sortBy])) { $sortBy = null; } list($tables, $wheres) = parent::_parseSearchParams($params, array(), $fields, $sortBy); $start = $page * $limit; // [JAS]: 1-based [TODO] clean up + document $total = -1; $sql = sprintf("SELECT " . "l.id as %s, " . "l.ticket_id as %s, " . "l.worker_id as %s, " . "l.change_date as %s, " . "l.change_field as %s, " . "l.change_value as %s " . "FROM ticket_audit_log l ", SearchFields_TicketAuditLog::ID, SearchFields_TicketAuditLog::TICKET_ID, SearchFields_TicketAuditLog::WORKER_ID, SearchFields_TicketAuditLog::CHANGE_DATE, SearchFields_TicketAuditLog::CHANGE_FIELD, SearchFields_TicketAuditLog::CHANGE_VALUE) . (!empty($wheres) ? sprintf("WHERE %s ", implode(' AND ', $wheres)) : "") . (!empty($sortBy) ? sprintf("ORDER BY %s %s", $sortBy, $sortAsc || is_null($sortAsc) ? "ASC" : "DESC") : ""); // [TODO] Could push the select logic down a level too if ($limit > 0) { $rs = $db->SelectLimit($sql, $limit, $start) or die(__CLASS__ . '(' . __LINE__ . ')' . ':' . $db->ErrorMsg()); /* @var $rs ADORecordSet */ } else { $rs = $db->Execute($sql) or die(__CLASS__ . '(' . __LINE__ . ')' . ':' . $db->ErrorMsg()); /* @var $rs ADORecordSet */ $total = $rs->RecordCount(); } $results = array(); if (is_a($rs, 'ADORecordSet')) { while (!$rs->EOF) { $result = array(); foreach ($rs->fields as $f => $v) { $result[$f] = $v; } $id = intval($rs->fields[SearchFields_TicketAuditLog::ID]); $results[$id] = $result; $rs->MoveNext(); } } // [JAS]: Count all if ($withCounts) { $rs = $db->Execute($sql); $total = $rs->RecordCount(); } return array($results, $total); }
public static function update($ids, $fields) { parent::_update($ids, self::_TABLE, $fields); }
static function update($ids, $fields) { parent::_update($ids, 'feed', $fields); }
static function update($ids, $fields) { if (!empty($fields['options'])) { $fields['options_json'] = json_encode($fields['options']); unset($fields['options']); } parent::_update($ids, 'export_type_params', $fields); self::clearCache(); }
/** * Enter description here... * * @param DevblocksSearchCriteria[] $params * @param integer $limit * @param integer $page * @param string $sortBy * @param boolean $sortAsc * @param boolean $withCounts * @return array */ static function search($params, $limit = 10, $page = 0, $sortBy = null, $sortAsc = null, $withCounts = true) { $db = DevblocksPlatform::getDatabaseService(); $fields = SearchFields_messageAuditLog::getFields(); // Sanitize if (!isset($fields[$sortBy])) { $sortBy = null; } list($tables, $wheres) = parent::_parseSearchParams($params, array(), $fields, $sortBy); $start = $page * $limit; // [JAS]: 1-based [TODO] clean up + document $total = -1; $sql = sprintf("SELECT " . "l.id as %s, " . "l.account_id as %s, " . "l.recipient_id as %s, " . "l.message_id as %s, " . "l.message_recipient_id as %s, " . "l.worker_id as %s, " . "l.change_date as %s, " . "l.change_field as %s, " . "l.change_value as %s " . "FROM audit_log_message l ", SearchFields_MessageAuditLog::ID, SearchFields_MessageAuditLog::ACCOUNT_ID, SearchFields_MessageAuditLog::RECIPIENT_ID, SearchFields_MessageAuditLog::MESSAGE_ID, SearchFields_MessageAuditLog::MESSAGE_RECIPIENT_ID, SearchFields_MessageAuditLog::WORKER_ID, SearchFields_MessageAuditLog::CHANGE_DATE, SearchFields_MessageAuditLog::CHANGE_FIELD, SearchFields_MessageAuditLog::CHANGE_VALUE) . (!empty($wheres) ? sprintf("WHERE %s ", implode(' AND ', $wheres)) : "") . (!empty($sortBy) ? sprintf("ORDER BY %s %s", $sortBy, $sortAsc || is_null($sortAsc) ? "ASC" : "DESC") : ""); // [TODO] Could push the select logic down a level too if ($limit > 0) { $rs = $db->SelectLimit($sql, $limit, $start) or die(__CLASS__ . '(' . __LINE__ . ')' . ':' . $db->ErrorMsg()); } else { $rs = $db->Execute($sql) or die(__CLASS__ . '(' . __LINE__ . ')' . ':' . $db->ErrorMsg()); $total = mysql_num_rows($rs); } $results = array(); while ($row = mysql_fetch_assoc($rs)) { $result = array(); foreach ($row as $f => $v) { $result[$f] = $v; } $id = intval($row[SearchFields_MessageAuditLog::ID]); $results[$id] = $result; } // [JAS]: Count all if ($withCounts) { $rs = $db->Execute($sql); $total = mysql_num_rows($rs); } mysql_free_result($rs); return array($results, $total); }
static function update($ids, $fields) { parent::_update($ids, 'watcher_mail_filter', $fields); }
public static function getSearchQueryComponents($columns, $params, $sortBy = null, $sortAsc = null) { $fields = SearchFields_DevblocksStorageProfile::getFields(); // Sanitize if (!isset($fields[$sortBy]) || '*' == substr($sortBy, 0, 1)) { $sortBy = null; } list($tables, $wheres) = parent::_parseSearchParams($params, $columns, $fields, $sortBy); $select_sql = sprintf("SELECT " . "devblocks_storage_profile.id as %s, " . "devblocks_storage_profile.name as %s, " . "devblocks_storage_profile.extension_id as %s, " . "devblocks_storage_profile.params_json as %s ", SearchFields_DevblocksStorageProfile::ID, SearchFields_DevblocksStorageProfile::NAME, SearchFields_DevblocksStorageProfile::EXTENSION_ID, SearchFields_DevblocksStorageProfile::PARAMS_JSON); $join_sql = "FROM devblocks_storage_profile "; // Custom field joins //list($select_sql, $join_sql, $has_multiple_values) = self::_appendSelectJoinSqlForCustomFieldTables( // $tables, // $params, // 'devblocks_storage_profile.id', // $select_sql, // $join_sql //); $where_sql = "" . (!empty($wheres) ? sprintf("WHERE %s ", implode(' AND ', $wheres)) : "WHERE 1 "); $sort_sql = !empty($sortBy) ? sprintf("ORDER BY %s %s ", $sortBy, $sortAsc || is_null($sortAsc) ? "ASC" : "DESC") : " "; $result = array('primary_table' => 'devblocks_storage_profile', 'select' => $select_sql, 'join' => $join_sql, 'where' => $where_sql, 'has_multiple_values' => $has_multiple_values, 'sort' => $sort_sql); return $result; }
static function update($ids, $fields) { parent::_update($ids, 'wgm_google_cse', $fields); }
static function update($ids, $fields) { parent::_update($ids, 'forums_source', $fields); }
/** * Enter description here... * * @param DevblocksSearchCriteria[] $params * @param integer $limit * @param integer $page * @param string $sortBy * @param boolean $sortAsc * @param boolean $withCounts * @return array */ static function search($params, $limit = 10, $page = 0, $sortBy = null, $sortAsc = null, $withCounts = true) { $db = DevblocksPlatform::getDatabaseService(); $fields = SearchFields_WorkerEvent::getFields(); // Sanitize if (!isset($fields[$sortBy])) { $sortBy = null; } list($tables, $wheres) = parent::_parseSearchParams($params, array(), $fields, $sortBy); $start = $page * $limit; // [JAS]: 1-based [TODO] clean up + document $total = -1; $sql = sprintf("SELECT " . "we.id as %s, " . "we.created_date as %s, " . "we.worker_id as %s, " . "we.title as %s, " . "we.content as %s, " . "we.is_read as %s, " . "we.url as %s " . "FROM worker_event we ", SearchFields_WorkerEvent::ID, SearchFields_WorkerEvent::CREATED_DATE, SearchFields_WorkerEvent::WORKER_ID, SearchFields_WorkerEvent::TITLE, SearchFields_WorkerEvent::CONTENT, SearchFields_WorkerEvent::IS_READ, SearchFields_WorkerEvent::URL) . (!empty($wheres) ? sprintf("WHERE %s ", implode(' AND ', $wheres)) : "") . (!empty($sortBy) ? sprintf("ORDER BY %s %s", $sortBy, $sortAsc || is_null($sortAsc) ? "ASC" : "DESC") : ""); // [TODO] Could push the select logic down a level too if ($limit > 0) { $rs = $db->SelectLimit($sql, $limit, $start) or die(__CLASS__ . '(' . __LINE__ . ')' . ':' . $db->ErrorMsg()); } else { $rs = $db->Execute($sql) or die(__CLASS__ . '(' . __LINE__ . ')' . ':' . $db->ErrorMsg()); $total = mysql_num_rows($rs); } $results = array(); while ($row = mysql_fetch_assoc($rs)) { $result = array(); foreach ($row as $f => $v) { $result[$f] = $v; } $ticket_id = intval($row[SearchFields_WorkerEvent::ID]); $results[$ticket_id] = $result; } // [JAS]: Count all if ($withCounts) { $rs = $db->Execute($sql); $total = mysql_num_rows($rs); } mysql_free_result($rs); return array($results, $total); }
static function update($ids, $fields) { parent::_update($ids, 'webapi_key', $fields); }
static function update($ids, $fields) { parent::_update($ids, 'macro_action', $fields); self::clearCache(); }
static function update($ids, $fields) { parent::_update($ids, 'kb_category', $fields); }
/** * Enter description here... * * @param DevblocksSearchCriteria[] $params * @param integer $limit * @param integer $page * @param string $sortBy * @param boolean $sortAsc * @param boolean $withCounts * @return array */ static function search($params, $limit = 10, $page = 0, $sortBy = null, $sortAsc = null, $withCounts = true) { $db = DevblocksPlatform::getDatabaseService(); $fields = SearchFields_RssExpItem::getFields(); // Sanitize if (!isset($fields[$sortBy])) { $sortBy = null; } list($tables, $wheres) = parent::_parseSearchParams($params, array(), $fields, $sortBy); $start = $page * $limit; // [JAS]: 1-based [TODO] clean up + document $select_sql = sprintf("SELECT " . "r.id as %s, " . "r.feed_id as %s, " . "r.title as %s, " . "r.url as %s, " . "r.created_date as %s, " . "r.is_read as %s, " . "f.name as %s ", SearchFields_RssExpItem::ID, SearchFields_RssExpItem::FEED_ID, SearchFields_RssExpItem::TITLE, SearchFields_RssExpItem::URL, SearchFields_RssExpItem::CREATED_DATE, SearchFields_RssExpItem::IS_READ, SearchFields_RssExpItem::FEED_NAME); $join_sql = "FROM rssexp_item r " . "LEFT JOIN rssexp_feed f ON (r.feed_id=f.id) "; // [JAS]: Dynamic table joins // (isset($tables['o']) ? "LEFT JOIN contact_org o ON (o.id=tt.debit_org_id)" : " "). // (isset($tables['mc']) ? "INNER JOIN message_content mc ON (mc.message_id=m.id)" : " "). $where_sql = "" . (!empty($wheres) ? sprintf("WHERE %s ", implode(' AND ', $wheres)) : ""); $sql = $select_sql . $join_sql . $where_sql . (!empty($sortBy) ? sprintf("ORDER BY %s %s", $sortBy, $sortAsc || is_null($sortAsc) ? "ASC" : "DESC") : ""); $rs = $db->SelectLimit($sql, $limit, $start) or die(__CLASS__ . '(' . __LINE__ . ')' . ':' . $db->ErrorMsg()); /* @var $rs ADORecordSet */ $results = array(); if (is_a($rs, 'ADORecordSet')) { while (!$rs->EOF) { $result = array(); foreach ($rs->fields as $f => $v) { $result[$f] = $v; } $id = intval($rs->fields[SearchFields_RssExpItem::ID]); $results[$id] = $result; $rs->MoveNext(); } } // [JAS]: Count all $total = -1; if ($withCounts) { $count_sql = "SELECT count(*) " . $join_sql . $where_sql; $total = $db->GetOne($count_sql); } return array($results, $total); }
/** * Enter description here... * * @param DevblocksSearchCriteria[] $params * @param integer $limit * @param integer $page * @param string $sortBy * @param boolean $sortAsc * @param boolean $withCounts * @return array */ static function search($columns, $params, $limit = 10, $page = 0, $sortBy = null, $sortAsc = null, $withCounts = true) { $db = DevblocksPlatform::getDatabaseService(); $fields = SearchFields_WatcherMailFilter::getFields(); // Sanitize if (!isset($fields[$sortBy])) { $sortBy = null; } list($tables, $wheres) = parent::_parseSearchParams($params, $columns, $fields, $sortBy); $start = $page * $limit; // [JAS]: 1-based [TODO] clean up + document $select_sql = sprintf("SELECT " . "wmf.id as %s, " . "wmf.pos as %s, " . "wmf.name as %s, " . "wmf.created as %s, " . "wmf.is_disabled as %s, " . "wmf.worker_id as %s ", SearchFields_WatcherMailFilter::ID, SearchFields_WatcherMailFilter::POS, SearchFields_WatcherMailFilter::NAME, SearchFields_WatcherMailFilter::CREATED, SearchFields_WatcherMailFilter::IS_DISABLED, SearchFields_WatcherMailFilter::WORKER_ID); $join_sql = "FROM watcher_mail_filter wmf "; // [JAS]: Dynamic table joins // (isset($tables['o']) ? "LEFT JOIN contact_org o ON (o.id=tt.debit_org_id)" : " "). // (isset($tables['mc']) ? "INNER JOIN message_content mc ON (mc.message_id=m.id)" : " "). // Custom field joins // list($select_sql, $join_sql, $has_multiple_values) = self::_appendSelectJoinSqlForCustomFieldTables( // $tables, // $params, // 'wmf.id', // $select_sql, // $join_sql // ); $where_sql = "" . (!empty($wheres) ? sprintf("WHERE %s ", implode(' AND ', $wheres)) : ""); $sort_sql = !empty($sortBy) ? sprintf("ORDER BY %s %s ", $sortBy, $sortAsc || is_null($sortAsc) ? "ASC" : "DESC") : " "; $sql = $select_sql . $join_sql . $where_sql . $sort_sql; $rs = $db->SelectLimit($sql, $limit, $start) or die(__CLASS__ . '(' . __LINE__ . ')' . ':' . $db->ErrorMsg()); /* @var $rs ADORecordSet */ $results = array(); if (is_a($rs, 'ADORecordSet')) { while (!$rs->EOF) { foreach ($rs->fields as $f => $v) { $result[$f] = $v; } $id = intval($rs->fields[SearchFields_WatcherMailFilter::ID]); $results[$id] = $result; $rs->MoveNext(); } } // [JAS]: Count all $total = -1; if ($withCounts) { $count_sql = ($has_multiple_values ? "SELECT COUNT(DISTINCT wmf.id) " : "SELECT COUNT(wmf.id) ") . $join_sql . $where_sql; $total = $db->GetOne($count_sql); } return array($results, $total); }
public static function update($ids, $fields) { // [TODO] Overload CONTENT as BlobUpdate parent::_update($ids, self::_TABLE, $fields); }