本文整理汇总了PHP中SearchHandler::setOrderby方法的典型用法代码示例。如果您正苦于以下问题:PHP SearchHandler::setOrderby方法的具体用法?PHP SearchHandler::setOrderby怎么用?PHP SearchHandler::setOrderby使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SearchHandler
的用法示例。
在下文中一共展示了SearchHandler::setOrderby方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _new
public function _new()
{
parent::_new();
$permissions = new PermissionCollection(new Permission());
$sh = new SearchHandler($permissions, FALSE);
$sh->addConstraint(new Constraint('parent_id', 'is', 'NULL'));
$sh->setOrderby('title');
$permissions->load($sh);
$systemcompany = $this->_uses[$this->modeltype];
if ($systemcompany->isLoaded()) {
$companypermissions = new CompanypermissionCollection(new Companypermission());
$checked = $companypermissions->getPermissionIDs($systemcompany->id);
$this->view->set('checked', $checked);
$debug = DebugOption::getCompanyOption($systemcompany->id);
$this->view->set('debug_id', $debug->id);
$this->view->set('selected_options', $debug->getOptions());
foreach ($permissions as $permission) {
$permission->setAdditional('permissions');
if (isset($checked[$permission->id])) {
$permission->permissions = TRUE;
} else {
$permission->permissions = FALSE;
}
}
}
$this->view->set('permissions', $permissions);
$debug = new DebugOption();
$this->view->set('debug_options', $debug->getEnumOptions('options'));
}
示例2: index
function index()
{
$this->view->set('clickaction', 'view');
$s_data = array();
$s_data['owner'] = EGS_USERNAME;
$this->setSearch('CalendarSearch', 'useDefault', $s_data);
parent::index(new CalendarCollection($this->_templateobject));
$calendar = new CalendarCollection($this->_templateobject);
$sh = new SearchHandler($calendar, false);
$sh->addConstraint(new Constraint('owner', '=', EGS_USERNAME));
$sh->setOrderby('name', 'ASC');
$calendar->load($sh);
if (isset($this->search) && ($this->isPrintDialog() || $this->isPrinting())) {
$this->printCollection($calendar);
}
$this->view->set('calendar', $calendar);
$this->view->set('num_records', $calendar->num_records);
$sidebar = new SidebarController($this->view);
$sidebar->addList('Events', array('new_event' => array('link' => array('module' => 'calendar', 'controller' => 'calendarevents', 'action' => 'new'), 'tag' => 'new_event'), 'view_events' => array('link' => array('module' => 'calendar', 'controller' => 'calendarevents', 'action' => 'index'), 'tag' => 'view_events')));
$sidebar->addList('Tasks', array('new_task' => array('link' => array('module' => 'projects', 'controller' => 'tasks', 'action' => 'new'), 'tag' => 'new_task'), 'view_tasks' => array('link' => array('module' => 'projects', 'controller' => 'tasks', 'action' => 'index'), 'tag' => 'view_tasks')));
$sidebar->addList('calendar_views', array('view_calendar' => array('link' => array('module' => 'calendar'), 'tag' => 'View Calendar')));
$sidebar->addList('calendars', array('new_personal_calendar' => array('link' => array('module' => 'calendar', 'controller' => 'calendars', 'action' => 'new_personal'), 'tag' => 'new_personal_calendar'), 'new_group_calendar' => array('link' => array('module' => 'calendar', 'controller' => 'calendars', 'action' => 'new_group'), 'tag' => 'new_group_calendar'), 'add_google_calendar' => array('link' => array('module' => 'calendar', 'controller' => 'calendars', 'action' => 'new_gcal'), 'tag' => 'add_google_calendar')));
$this->view->register('sidebar', $sidebar);
$this->view->set('sidebar', $sidebar);
}
示例3: RoleCollection
function __construct($getCurrentValues = true)
{
parent::__construct();
$userPreferences = UserPreferences::instance();
$this->setModuleName('contacts');
$roleCollection = new RoleCollection();
$sh = new SearchHandler($roleCollection, false);
$sh->AddConstraint(new Constraint('usercompanyid', '=', EGS_COMPANY_ID));
$sh->setOrderby('name');
$roleCollection->load($sh);
$roles = array();
foreach ($roleCollection->getContents() as $role) {
$roles[$role->id] = array('value' => $role->id, 'label' => $role->name);
if ($getCurrentValues) {
if (in_array($role->id, $userPreferences->getPreferenceValue('default-read-roles', 'contacts'))) {
$roles[$role->id]['selected'] = true;
}
}
}
$this->registerPreference(array('name' => 'default-read-roles', 'display_name' => 'Default Read Access', 'type' => 'select_multiple', 'data' => $roles, 'default' => array()));
foreach ($roleCollection->getContents() as $role) {
$roles[$role->id] = array('value' => $role->id, 'label' => $role->name);
if ($getCurrentValues) {
if (in_array($role->id, $userPreferences->getPreferenceValue('default-write-roles', 'contacts'))) {
$roles[$role->id]['selected'] = true;
}
}
}
$this->registerPreference(array('name' => 'default-write-roles', 'display_name' => 'Default Write Access', 'type' => 'select_multiple', 'data' => $roles, 'default' => array()));
}
示例4: index
public function index()
{
$id = $this->_data['stitem_id'];
$transaction = new STItem();
$transaction->load($id);
$this->view->set('transaction', $transaction);
$outside_ops = new MFOutsideOperationCollection($this->_templateobject);
$sh = new SearchHandler($outside_ops, false);
$cc = new ConstraintChain();
$cc->add(new Constraint('stitem_id', '=', $id));
$db = DB::Instance();
$date = Constraint::TODAY;
$between = $date . ' BETWEEN ' . $db->IfNull('start_date', $date) . ' AND ' . $db->IfNull('end_date', $date);
$cc->add(new Constraint('', '', '(' . $between . ')'));
$sh->addConstraintChain($cc);
$sh->setOrderby('op_no');
$outside_ops->load($sh);
$this->view->set('outside_ops', $outside_ops);
$this->view->set('linkfield', 'id');
$this->view->set('linkvaluefield', 'id');
$this->view->set('clickaction', 'view');
$this->view->set('clickcontroller', 'MFOutsideOperations');
$this->view->set('no_ordering', true);
$sidebar = new SidebarController($this->view);
$sidebar->addList('Show', array('allItems' => array('tag' => 'All Items', 'link' => array_merge($this->_modules, array('controller' => 'STItems', 'action' => 'index'))), 'thisItem' => array('tag' => 'Item Detail', 'link' => array_merge($this->_modules, array('controller' => 'STItems', 'action' => 'view', 'id' => $id))), 'addoperation' => array('tag' => 'Add Outside Operation', 'link' => array_merge($this->_modules, array('controller' => $this->name, 'action' => 'new', 'stitem_id' => $id)))));
$this->view->register('sidebar', $sidebar);
$this->view->set('sidebar', $sidebar);
}
示例5: getPeople
function getPeople($category_id)
{
$sh = new SearchHandler($this, false);
$sh->addConstraint(new Constraint('category_id', '=', $category_id));
$sh->setOrderby('surname');
$this->load($sh);
}
示例6: remittanceList
function remittanceList($trans_id)
{
$sh = new SearchHandler($this, false);
$sh->addConstraint(new Constraint('status', '=', 'P'));
$sh->addConstraint(new Constraint('cross_ref', '=', $trans_id));
$sh->setOrderby('transaction_date');
$this->load($sh);
}
示例7: getPermissionIDs
function getPermissionIDs($systemcompany, $orderby = 'permission')
{
$sh = new SearchHandler($this, false, false);
$sh->setFields(array('permissionid', 'permission'));
$sh->addConstraint(new Constraint('usercompanyid', '=', $systemcompany));
$sh->setOrderby($orderby);
$this->load($sh);
return $this->getAssoc();
}
示例8: getPermissions
function getPermissions($systemcompany, $roles = null, $orderby = 'permission')
{
$sh = new SearchHandler($this, false);
$sh->addConstraint(new Constraint('usercompanyid', '=', $systemcompany));
if (!empty($roles)) {
$sh->addConstraint(new Constraint('roleid', 'in', '(' . $roles . ')'));
}
$sh->setOrderby($orderby);
$this->load($sh);
}
示例9: getCompanies
function getCompanies($category_id)
{
$sh = new SearchHandler($this, false);
if (is_array($category_id)) {
$sh->addConstraint(new Constraint('category_id', 'in', '(' . implode(',', $category_id) . ')'));
} else {
$sh->addConstraint(new Constraint('category_id', '=', $category_id));
}
$sh->setOrderby('company');
$this->load($sh);
}
示例10: getOutsideOperationCosts
public static function getOutsideOperationCosts(ConstraintChain $cc, $type = 'latest')
{
$mfoutsideops = new MFOutsideOperationCollection();
$sh = new SearchHandler($mfoutsideops, false);
$sh->addConstraintChain($cc);
$fields = array('id', 'op_no', 'description', $type . '_osc');
$sh->setFields($fields);
$sh->setOrderby('op_no');
$mfoutsideops->load($sh);
return $mfoutsideops;
}
示例11: getCurrentPeriod
function getCurrentPeriod()
{
//
// Returns one row containing the 'current' period
// i.e. the oldest period that is still open
//
$sh = new SearchHandler(new GLPeriodCollection($this), false);
$sh->fields = '*';
$sh->addConstraint(new Constraint('closed', 'is not', 'true'));
$sh->setOrderby('enddate', 'ASC');
$this->loadBy($sh);
}
示例12: getWorkOrders
public function getWorkOrders($stitem_id = '')
{
if (empty($stitem_id)) {
return array();
}
$mfworkorders = new MFWorkorderCollection();
$sh = new SearchHandler($mfworkorders, false);
$sh->addConstraint(new Constraint('stitem_id', '=', $stitem_id));
$sh->setOrderby('wo_number', 'DESC');
$mfworkorders->load($sh);
return $mfworkorders->getAssoc('wo_number');
}
示例13: __construct
public function __construct($tablename = 'gl_centres')
{
parent::__construct($tablename);
$this->identifierField = 'cost_centre || \' - \' || description';
$this->hasMany('GLAccountCentre', 'accounts', 'glcentre_id');
$this->orderby = 'cost_centre';
$this->validateUniquenessOf('cost_centre');
$sh = new SearchHandler(new GLAccountCentreCollection(new GLAccountCentre()), false);
$sh->setOrderby('glaccount');
$this->addSearchHandler('accounts', $sh);
// Define related item rules
$this->linkRules = array('accounts' => array('actions' => array(), 'rules' => array()));
}
示例14: remittanceList
function remittanceList($trans_id)
{
$allocation = DataObjectFactory::Factory('PLAllocation');
$allocation->loadBy('transaction_id', $trans_id);
if ($allocation->isLoaded()) {
$sh = new SearchHandler($this, false);
$sh->addConstraint(new Constraint('transaction_type', '!=', 'P'));
$sh->addConstraint(new Constraint('status', '=', 'P'));
$sh->addConstraint(new Constraint('allocation_id', '=', $allocation->allocation_id));
$sh->setOrderby('transaction_date');
$this->load($sh);
}
}
示例15: getItemDates
public function getItemDates($cc = "")
{
$sh = new SearchHandler($this, FALSE);
$DisplayFields = array('due_date', 'stitem_id', 'stitem', 'required');
$sh->setOrderby('due_date');
$sh->setFields($DisplayFields);
if (!empty($cc) && $cc instanceof ConstraintChain) {
$sh->addConstraintChain($cc);
}
$this->_tablename = 'so_itemdates';
$this->load($sh);
return $this;
}