public static function handleBrowseRequest($options = array(), $conditions = array(), $responseID = null, $responseData = array()) { if ($_REQUEST['q'] != 'all') { $conditions[] = 'AccountLevel != "Disabled"'; } return parent::handleBrowseRequest($options, $conditions, $responseID, $responseData); }
public static function respond($responseID, $responseData = [], $responseMode = false) { if ($responseID == 'projectUpdates' && $_GET['format'] == 'rss') { header('Content-Type: application/rss+xml'); return \Emergence\Dwoo\Engine::respond('projectUpdates.rss', $responseData); } return parent::respond($responseID, $responseData, $responseMode); }
protected static function applyRecordDelta(ActiveRecord $Buzz, $requestData) { if (isset($requestData['Published']) && is_array($requestData['Published'])) { $datetime = trim($requestData['Published']['date'] . ' ' . $requestData['Published']['time']); $requestData['Published'] = $datetime ? strtotime($datetime) : null; } return parent::applyRecordDelta($Buzz, $requestData); }
public static function handleBrowseRequest($options = array(), $conditions = array(), $responseID = null, $responseData = array()) { if (!$GLOBALS['Session']->hasAccountLevel('Staff') || empty($_GET['showall'])) { static::$browseConditions['Status'] = 'Published'; static::$browseConditions[] = 'Published IS NULL OR Published <= CURRENT_TIMESTAMP'; } return parent::handleBrowseRequest($options, $conditions, $responseID, $responseData); }
public static function handleRecordRequest(ActiveRecord $Endpoint, $action = false) { switch ($action ? $action : ($action = static::shiftPath())) { case 'rewrites': return static::handleRewritesRequest($Endpoint); default: return parent::handleRecordRequest($Endpoint, $action); } }
public static function handleRecordRequest(\ActiveRecord $Competency, $action = false) { switch ($action ? $action : ($action = static::shiftPath())) { case 'demonstrations': return static::handleDemonstrationsRequest($Competency); default: return parent::handleRecordRequest($Competency, $action); } }
public static function respond($responseID, $responseData = array(), $responseMode = false) { if (static::$responseMode == 'rss') { static::$responseMode = 'xml'; return parent::respond('rss', $responseData); } else { return parent::respond($responseID, $responseData); } }
public static function respondCsv($responseID, $responseData = []) { if ($responseID == 'loggedRequests') { foreach ($responseData['data'] as &$result) { $result = ['timestamp' => date('Y-m-d H:i:s', $result->Created), 'endpoint' => $result->Endpoint->Handle, 'key' => $result->Key ? $result->Key->Handle : '', 'client_IP' => long2ip($result->ClientIP), 'method' => $result->Method, 'path' => $result->Path, 'query' => $result->Query, 'response_code' => $result->ResponseCode, 'response_time' => $result->ResponseTime, 'response_bytes' => $result->ResponseBytes]; } } return parent::respondCsv($responseID, $responseData); }
public static function handleRecordRequest(ActiveRecord $Tag, $action = false) { switch ($action ? $action : ($action = static::shiftPath())) { case 'items': return static::handleTagItemsRequest($Tag); default: return parent::handleRecordRequest($Tag, $action); } }
public static function handleRecordRequest(\ActiveRecord $ContentArea, $action = false) { switch ($action ? $action : ($action = static::shiftPath())) { case 'competencies': return static::handleCompetenciesRequest($ContentArea); case 'recent-progress': return static::handleRecentProgressRequest($ContentArea, $action); default: return parent::handleRecordRequest($ContentArea, $action); } }
protected static function applyRecordDelta(\ActiveRecord $Ban, $data) { if (isset($data['IP']) && !is_numeric($data['IP'])) { $data['IP'] = ip2long($data['IP']); } if (isset($data['KeyID']) && !is_numeric($data['KeyID'])) { $Key = Key::getByHandle($data['KeyID']); $data['KeyID'] = $Key ? $Key->ID : null; } return parent::applyRecordDelta($Ban, $data); }
public static function handleRecordRequest(ActiveRecord $Key, $action = false) { switch ($action ?: ($action = static::shiftPath())) { case 'endpoints': return static::handleEndpointsRequest($Key); case 'share': return static::handleShareRequest($Key); case 'revoke': return static::handleRevokeRequest($Key); default: return parent::handleRecordRequest($Key, $action); } }
public static function handleRecordRequest(ActiveRecord $Alert, $action = false) { switch ($action ?: ($action = static::shiftPath())) { case 'acknowledge': return static::handleAcknowledgeRequest($Alert); case 'dismiss': return static::handleDismissRequest($Alert); case 'email-preview': return static::handleEmailPreviewRequest($Alert); default: return parent::handleRecordRequest($Alert, $action); } }
public static function getRecordByHandle($handle) { $Record = parent::getRecordByHandle($handle); // redirect to correct handler if ($Record && !is_a($Record, static::$recordClass)) { $url = $Record->getURL(); if ($rest = static::getPath()) { $url .= '/' . implode('/', $rest); } \Site::redirect($url); } return $Record; }
public static function handleBrowseRequest($options = array(), $conditions = array(), $responseID = null, $responseData = array()) { if (!empty($_GET['skill']) && ctype_digit($_GET['skill'])) { // TODO: implement this as a lower-level override to the generated browse query so it can be a FROM subquery try { $demonstrations = DB::allValues('DemonstrationID', 'SELECT DemonstrationID FROM `%s` WHERE SkillID = %u', [DemonstrationSkill::$tableName, $_GET['skill']]); } catch (TableNotFoundException $e) { $demonstrations = []; } $conditions[] = 'ID IN (' . implode($demonstrations, ',') . ')'; } if (!empty($_GET['student']) && ctype_digit($_GET['student'])) { $conditions['StudentID'] = $_GET['student']; } return parent::handleBrowseRequest($options, $conditions, $responseID, $responseData); }
public static function handleBrowseRequest($options = [], $conditions = [], $responseID = null, $responseData = []) { // apply tag filter if (!empty($_REQUEST['tag'])) { // get tag if (!($Tag = Tag::getByHandle($_REQUEST['tag']))) { return static::throwNotFoundError('Tag not found'); } $conditions[] = 'ID IN (SELECT ContextID FROM tag_items WHERE TagID = ' . $Tag->ID . ' AND ContextClass = "Laddr\\\\Project")'; } // apply stage filter if (!empty($_REQUEST['stage'])) { $conditions['Stage'] = $_REQUEST['stage']; } return parent::handleBrowseRequest($options, $conditions, $responseID, $responseData); }
public static function handleBrowseRequest($options = array(), $conditions = array(), $responseID = null, $responseData = array()) { // apply tag filter if (!empty($_REQUEST['tag'])) { // get tag if (!($Tag = Tag::getByHandle($_REQUEST['tag']))) { return static::throwNotFoundError('Tag not found'); } $conditions[] = 'ID IN (SELECT ContextID FROM tag_items WHERE TagID = ' . $Tag->ID . ' AND ContextClass = "Product")'; } // apply context filter if (!empty($_REQUEST['ContextClass'])) { $conditions['ContextClass'] = $_REQUEST['ContextClass']; } if (!empty($_REQUEST['ContextID']) && is_numeric($_REQUEST['ContextID'])) { $conditions['ContextID'] = $_REQUEST['ContextID']; } return parent::handleBrowseRequest($options, $conditions, $responseID, $responseData); }