public static function renderSearchPanel($searchPanelId, $fieldname, $entityClass, $tenantid) { $class = ClassFactory::getClass($entityClass, 0, $tenantid); $searchFields = $class->getSearchFields(); echo '<div id="' . $searchPanelId . '" class="panel panel-default entitySearchPanel" style="display:none"> <div class="panel-body"> <div class="input-group"><span class="input-group-addon" id="basic-addon3">Search by:</span> <select id="' . $entityClass . 'SearchType" class="form-control">'; $selected = ''; foreach ($searchFields as $searchField) { echo '<option value="' . $searchField . '"' . $selected . '>' . $class->friendlyName($searchField) . '</option>'; } echo ' </select></div><br/>'; echo ' <div class="input-group">'; echo ' <input id="' . $entityClass . 'SearchBox" id= type="text" class="form-control" value="" placeholder="enter search criteria">'; echo ' <span class="btn btn-primary input-group-addon" onclick="searchEntity(\'' . $entityClass . '\');">Search</span>'; echo ' </div></br>'; echo ' <div id="' . $entityClass . 'SearchResults" class="searchResults"></div>'; echo ' <div id="' . $entityClass . 'SearchPreview" class="searchPreview hidden">PREVIEW!</div>'; echo ' </div> </div>'; }
$numToReturn = Utility::getRequestVariable('numToLoad', 0); if ($numToReturn == 0) { $numToReturn = Utility::getRequestVariable('return', 10); } if ($numToReturn > 100) { $numToReturn = 100; // let's not get crazy, people. } $offset = Utility::getRequestVariable('offset', 0); $listId = Utility::getRequestVariable('list', 0); if ($listId == 0) { $listId = Utility::getRequestVariable('entityList', 0); } $descending = Utility::getRequestVariable('desc', 'false'); try { $class = ClassFactory::getClass($type, $userID, $tenantID); } catch (Exception $ex) { Service::returnError('Unknown or uncreatable type: ' . $type, 400, 'entitiesService?type=' . $type); } if ($_SERVER['REQUEST_METHOD'] == "GET") { if ($listId > 0) { // a list was requested here. Different handling than regular entity set try { $totalEntities = $class->getEntityCountForList($listId); $entities = $class->getEntitiesFromList($listId, $numToReturn, $offset); } catch (Exception $ex) { $message = 'Unable to retrieve ' . $type . ' set count: ' . $ex->getMessage(); Service::returnError($message); } } else { $totalEntities = $class->getEntityCount($_GET);