• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP ConstraintChain类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中ConstraintChain的典型用法代码示例。如果您正苦于以下问题:PHP ConstraintChain类的具体用法?PHP ConstraintChain怎么用?PHP ConstraintChain使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了ConstraintChain类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: _new

 public function _new()
 {
     parent::_new();
     $resource = $this->_uses[$this->modeltype];
     $db = DB::Instance();
     if ($resource->isLoaded()) {
         $this->_data['work_schedule_id'] = $resource->work_schedule_id;
         $this->view->set('workschedule', $resource->work_schedule_detail);
     } elseif (isset($this->_data['work_schedule_id'])) {
         $resource->work_schedule_id = $this->_data['work_schedule_id'];
         $this->view->set('workschedule', $resource->work_schedule_detail);
     } else {
         $workschedule = DataObjectFactory::Factory('WorkSchedule');
         $cc = new ConstraintChain();
         $cc->add(new Constraint('status', '!=', $workschedule->completedStatus()));
         $cc->add(new Constraint('status', '!=', $workschedule->cancelledStatus()));
         $this->view->set('workschedules', $workschedule->getAll($cc));
     }
     $person = DataObjectFactory::Factory('Person');
     $cc = new ConstraintChain();
     $cc->add(new Constraint('company_id', '=', COMPANY_ID));
     $this->view->set('people', $person->getAll($cc));
     $resources = new EngineeringResourceCollection($this->_templateobject);
     $sh = $this->setSearchHandler($resources);
     $sh->addConstraint(new Constraint('work_schedule_id', '=', $resource->work_schedule_id));
     parent::index($resources, $sh);
     $this->view->set('clickaction', 'edit');
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:28,代码来源:EngineeringresourcesController.php


示例2: getDataOptions

 public function getDataOptions($model = '', $cc = '')
 {
     if (empty($model)) {
         $model = $this->getModel();
         if (!$model) {
             return false;
         }
     }
     $attribute = $this->internal_attribute;
     if ($model->idField == $attribute) {
         return $model->getAll($cc);
     } elseif (isset($model->belongsToField[$attribute])) {
         $x = $model->belongsTo[$model->belongsToField[$attribute]]["model"];
         if (empty($cc) || !$cc instanceof ConstraintChain) {
             $cc = new ConstraintChain();
         }
         if ($model->belongsTo[$model->belongsToField[$attribute]]["cc"] instanceof ConstraintChain) {
             $cc->add($model->belongsTo[$model->belongsToField[$attribute]]["cc"]);
         }
         $x = new $x();
         return $x->getAll($cc);
     } else {
         return array();
     }
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:25,代码来源:DataMapping.php


示例3: getTotals

 public function getTotals($_project_id = '', $_task_id = '')
 {
     if (empty($_project_id)) {
         return false;
     }
     $cc = new ConstraintChain();
     $cc->add(new Constraint('project_id', '=', $_project_id));
     if (!empty($_task_id)) {
         $cc->add(new Constraint('task_id', '=', $_task_id));
     }
     $costs_charges = array();
     foreach ($this->getEnumOptions('item_type') as $key => $type) {
         $cc1 = new ConstraintChain();
         $cc1->add($cc);
         $cc1->add(new Constraint('item_type', '=', $key));
         switch ($key) {
             case 'PO':
                 $subkey = 'total_costs';
                 $tablename = 'project_purchase_orders';
                 break;
             case 'SI':
                 $subkey = 'total_invoiced';
                 $tablename = 'project_sales_invoices';
                 break;
         }
         $totals = $this->getSumFields(array('net_value'), $cc1, $tablename);
         $costs_charges[$subkey] = $totals['net_value'];
     }
     return $costs_charges;
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:30,代码来源:ProjectCostCharge.php


示例4: getTypesForEmployee

 function getTypesForEmployee($_employee_id)
 {
     $cc = new ConstraintChain();
     $cc->add(new Constraint('employee_id', '=', $_employee_id));
     $this->identifierField = 'authorisation_type';
     return $this->getAll($cc);
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:7,代码来源:HRAuthoriser.php


示例5: getBinList

 static function getBinList($whlocation_id)
 {
     $bins = new WHBin();
     $cc = new ConstraintChain();
     $cc->add(new Constraint('whlocation_id', '=', $whlocation_id));
     return $bins->getAll($cc);
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:7,代码来源:WHBin.php


示例6: getCentres

 public function getCentres()
 {
     $mf_centre = DataObjectFactory::Factory('MFCentre');
     $cc = new ConstraintChain();
     $cc->add(new Constraint('production_recording', 'is', 'true'));
     return $mf_centre->getAll($cc);
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:7,代码来源:ProductionRecordingController.php


示例7: _new

 public function _new()
 {
     $resource = $this->_uses[$this->modeltype];
     if (!$resource->isLoaded()) {
         if (empty($this->_data['project_id'])) {
             $project = new Project();
             $projects = $project->getAll();
             $project_id = key($projects);
         } else {
             $project_id = $this->_data['project_id'];
         }
         $this->view->set('project_id', $project_id);
         $tasks = $this->getTaskList($project_id);
         $dates = $this->getStartEndDate($project_id);
         $this->view->set('start_date', $dates['start_date']['data']);
         $this->view->set('end_date', $dates['end_date']['data']);
     } else {
         $tasks = $this->getTaskList($resource->project_id);
     }
     $this->view->set('tasks', $tasks);
     $person = new Person();
     $cc = new ConstraintChain();
     $cc->add(new Constraint('company_id', '=', COMPANY_ID));
     $this->view->set('people', $person->getAll($cc));
     parent::_new();
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:26,代码来源:ResourcesController.php


示例8: view

 public function view()
 {
     if (!$this->loadData()) {
         sendback();
     }
     $ledgercategory = $this->_uses[$this->modeltype];
     $idfield = $ledgercategory->idField;
     $id = $ledgercategory->{$idfield};
     // Check if Ledger Category is used by Ledger Accounts
     $ledgeraccount = new LedgerCategory('ledger_category_accounts');
     $ledgeraccount->idField = 'company_id';
     $ledgeraccount->identifierField = 'name';
     $cc = new ConstraintChain();
     $cc->add(new Constraint('category_id', '=', $ledgercategory->category_id));
     $ledgeraccounts = $ledgeraccount->getAll($cc);
     $sidebar = new SidebarController($this->view);
     $sidebarlist = array();
     $sidebarlist['all'] = array('link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'index'), 'tag' => 'view_ledger_categories');
     $sidebarlist['new'] = array('link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'new'), 'tag' => 'new_ledger_category');
     if (count($ledgeraccounts) == 0) {
         $sidebarlist['edit'] = array('link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'edit', $idfield => $ledgercategory->{$idfield}), 'tag' => 'edit_ledger_category');
         $sidebarlist['delete'] = array('link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'delete', $idfield => $ledgercategory->{$idfield}), 'tag' => 'delete_ledger_category');
     }
     $sidebar->addList('Actions', $sidebarlist);
     $this->view->register('sidebar', $sidebar);
     $this->view->set('sidebar', $sidebar);
     $this->view->set('model', $ledgercategory);
     $this->view->set('count', count($ledgeraccounts));
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:29,代码来源:LedgercategorysController.php


示例9: useDefault

 public static function useDefault($search_data = null, &$errors = array(), $defaults = null)
 {
     $search = new poauthlimitsSearch($defaults);
     // Search by Person
     $search->addSearchField('username', 'Person', 'select', '');
     $people = DataObjectFactory::Factory('Usercompanyaccess');
     $people->idField = 'username';
     $people->identifierField = 'username';
     $people->orderby = 'username';
     $options = array('0' => 'All');
     $cc = new ConstraintChain();
     $cc->add(new Constraint('usercompanyid', '=', EGS_COMPANY_ID));
     $peoplelist = $people->getAll($cc);
     $options += $peoplelist;
     $search->setOptions('username', $options);
     // Search by GL Centre
     $search->addSearchField('glcentre_id', 'GL Centre', 'select', 0);
     $options = array('0' => 'All');
     $centres = DataObjectFactory::Factory('GLCentre');
     $centrelist = $centres->getAll();
     $options += $centrelist;
     $search->setOptions('glcentre_id', $options);
     $search->setSearchData($search_data, $errors);
     return $search;
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:25,代码来源:poauthlimitsSearch.php


示例10: load

 function load($sh, $c_query = null)
 {
     $db = DB::Instance();
     $qb = new QueryBuilder($db, $this->_doname);
     if ($sh instanceof SearchHandler) {
         if ($this->_templateobject->isAccessControlled()) {
             if (isModuleAdmin()) {
                 $cc = new ConstraintChain();
                 $cc->add(new Constraint('usercompanyid', '=', EGS_COMPANY_ID));
                 $cc->add(new Constraint('id', '=', EGS_COMPANY_ID), 'OR');
                 $sh->addConstraintChain($cc);
                 $qb->setDistinct();
             } else {
                 $cc = new ConstraintChain();
                 $cc->add(new Constraint('usernameaccess', '=', EGS_USERNAME));
                 $cc->add(new Constraint('owner', '=', EGS_USERNAME), 'OR');
                 $cc2 = new ConstraintChain();
                 $cc2->add(new Constraint('usercompanyid', '=', EGS_COMPANY_ID));
                 $sh->addConstraintChain($cc);
                 $sh->addConstraintChain($cc2);
                 $qb->setDistinct();
             }
         }
         $this->sh = $sh;
     }
     $this->_load($sh, $qb, $c_query);
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:27,代码来源:PersonCollection.php


示例11: 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);
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:28,代码来源:MfoutsideoperationsController.php


示例12: toConstraintChain

 public function toConstraintChain()
 {
     $cc = new ConstraintChain();
     if ($this->cleared) {
         return $cc;
     }
     debug('BaseSearch::toConstraintChain Fields: ' . print_r($this->fields, true));
     foreach ($this->fields as $group) {
         foreach ($group as $field => $searchField) {
             if ($field == 'balance') {
                 $cc1 = new ConstraintChain();
                 if ($searchField->getValue() == '') {
                     $cc1->add(new Constraint('balance', '>', '0'));
                 }
                 $cc->add($cc1);
             } elseif ($field != 'parent_id' && $field != 'search_id') {
                 $c = $searchField->toConstraint();
                 if ($c !== false) {
                     $cc->add($c);
                 }
             }
         }
     }
     debug('BaseSearch::toConstraintChain Constraints: ' . print_r($cc, true));
     return $cc;
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:26,代码来源:whlocationsSearch.php


示例13: getCalendarList

 function getCalendarList($options = array())
 {
     $calendars = new CalendarCollection(new Calendar());
     $sh = new SearchHandler($calendars, false);
     $cc = new ConstraintChain();
     $cc->add(new Constraint('owner', '=', EGS_USERNAME));
     $cc->add(new Constraint('username', '=', EGS_USERNAME), 'OR');
     $sh->addConstraintChain($cc);
     $sh->setOrderby('name', 'ASC');
     $calendars->load($sh);
     $calendar_list = $calendars->getArray();
     if (count($calendar_list) > 0) {
         foreach ($calendar_list as $key => $value) {
             if (isset($options[$value['id']]['status']) && $options[$value['id']]['status'] == 'on') {
                 $calendar_list[$key]['show'] = true;
             } else {
                 $calendar_list[$key]['show'] = false;
             }
             switch ($value['type']) {
                 case "personal":
                 case "group":
                     $calendar_list[$key]['url'] = "/?module=calendar&controller=index&action=getJSON&id=" . $value['id'];
                     break;
                 case "gcal":
                     $calendar_list[$key]['url'] = $calendar_list[$key]['gcal_url'];
                     break;
             }
             $calendar_list[$key]['className'] = str_replace("#", "", $calendar_list[$key]['colour']);
         }
     }
     return $calendar_list;
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:32,代码来源:IndexController.php


示例14: edit

 public function edit()
 {
     $this->view->set('field_name', $this->_data['field_name']);
     $modulecomponent = new ModuleComponent();
     $modulecomponent->load($this->_data['module_components_id']);
     $model = new $modulecomponent->name();
     $field = $model->getField($this->_data['field_name']);
     $this->view->set('field', $field);
     if (isset($model->belongsToField[$field->name])) {
         $x = $model->belongsTo[$model->belongsToField[$field->name]]["model"];
         $cc = new ConstraintChain();
         if ($model->belongsTo[$model->belongsToField[$field->name]]["cc"] instanceof ConstraintChain) {
             $cc->add($model->belongsTo[$model->belongsToField[$field->name]]["cc"]);
         }
         $x = new $x();
         $this->view->set('options', $x->getAll($cc));
         $field->type = 'select';
     }
     if ($model->isEnum($field->name)) {
         $this->view->set('options', $model->getEnumOptions($field->name));
         $field->type = 'select';
     }
     if (empty($this->_data['id'])) {
         //			sendTo($this->name,'new',$this->_modules);
         unset($this->_data['id']);
         $this->view->set('module_components_id', $this->_data['module_components_id']);
         parent::_new();
         $this->_templateName = $this->getTemplateName('new');
     } else {
         parent::edit();
     }
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:32,代码来源:ModuledefaultsController.php


示例15: confirmReceipt

 public static function confirmReceipt($search_data = null, &$errors = array(), $defaults = null)
 {
     $search = new pogoodsreceivedSearch($defaults);
     // Search by Customer
     $search->addSearchField('plmaster_id', 'Supplier', 'select', 0);
     $supplier = new PLSupplier();
     $options = array('0' => 'Select Supplier');
     $suppliers = $supplier->getAll(null, false, true);
     $options += $suppliers;
     $search->setOptions('plmaster_id', $options);
     // Search by Stock Item
     $search->addSearchField('stitem_id', 'Stock Item', 'select', 0);
     $stitems = new STItem();
     $options = array('0' => 'All');
     $stitems = $stitems->getAll();
     $options += $stitems;
     $search->setOptions('stitem_id', $options);
     // Search by Order Number
     $search->addSearchField('order_id', 'order_number', 'select', 0);
     $orderlines = new POrder();
     $cc = new ConstraintChain();
     $cc->add(new Constraint('status', 'in', "('A','O','P')"));
     $orderlines->orderby = 'order_number';
     $options = array('0' => 'All');
     $orderlines = $orderlines->getAll($cc);
     $options += $orderlines;
     $search->setOptions('order_id', $options);
     $search->setSearchData($search_data, $errors, 'confirmReceipt');
     // Do not save the order_id
     // - if the order is confirmed, then it will not be in the list on re-query
     if (isset($_SESSION['searches'][get_class($search)]['confirmReceipt']['order_id'])) {
         unset($_SESSION['searches'][get_class($search)]['confirmReceipt']['order_id']);
     }
     return $search;
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:35,代码来源:pogoodsreceivedSearch.php


示例16: view_allocations

 public function view_allocations()
 {
     $flash = Flash::Instance();
     $collection = new SLTransactionCollection($this->_templateobject);
     $this->_templateobject->setAdditional('payment_value', 'numeric');
     $allocation = DataObjectFactory::Factory('SLAllocation');
     $allocationcollection = new SLAllocationCollection($allocation);
     $collection->_tablename = $allocationcollection->_tablename;
     $sh = $this->setSearchHandler($collection);
     $fields = array("our_reference||'-'||transaction_type as id", 'customer', 'slmaster_id', 'transaction_date', 'transaction_type', 'our_reference', 'ext_reference', 'currency', 'gross_value', 'allocation_date');
     $sh->setGroupBy($fields);
     $fields[] = 'sum(payment_value) as payment_value';
     $sh->setFields($fields);
     if (isset($this->_data['trans_id'])) {
         $allocation->identifierField = 'allocation_id';
         $cc = new ConstraintChain();
         $cc->add(new Constraint('transaction_id', '=', $this->_data['trans_id']));
         $alloc_ids = $allocation->getAll($cc);
         if (count($alloc_ids) > 0) {
             $sh->addConstraint(new Constraint('allocation_id', 'in', '(' . implode(',', $alloc_ids) . ')'));
         } else {
             $flash->addError('Error loading allocation');
             sendBack();
         }
     }
     parent::index($collection, $sh);
     $this->view->set('collection', $collection);
     $this->view->set('invoice_module', 'sales_invoicing');
     $this->view->set('invoice_controller', 'sinvoices');
     $this->view->set('clickaction', 'view');
     $this->view->set('clickcontroller', 'slcustomers');
     $this->view->set('linkvaluefield', 'slmaster_id');
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:33,代码来源:SltransactionsController.php


示例17: getvalue

 function getvalue()
 {
     $model = $this->get_model();
     if ($this->idField == $this->fieldname) {
         $cc = new ConstraintChain();
         if (substr($this->value, -1) == ')') {
             $cc->add(new Constraint($model->idField, 'IN', $this->value));
         } else {
             $cc->add(new Constraint($model->idField, '=', $this->value));
         }
         $values = $model->getAll($cc);
         if (count($values) > 0) {
             return implode(',', $values);
         }
     } elseif (isset($model->belongsToField[$this->fieldname])) {
         if ($this->value === "'NULL'") {
             return 'NULL';
         }
         $fk = DataObjectFactory::Factory($model->belongsTo[$model->belongsToField[$this->fieldname]]['model']);
         $fk->load($this->value);
         return $fk->getIdentifierValue();
     } elseif ($model->isEnum($this->fieldname)) {
         return $model->getEnum($this->fieldname, $this->value);
     }
     return $this->value;
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:26,代码来源:SystemObjectPolicy.php


示例18: getReportTypes

 public static function getReportTypes()
 {
     $report_type = DataObjectFactory::Factory('ReportType');
     $cc = new ConstraintChain();
     $cc->add(new Constraint('public', 'IS', TRUE));
     return $report_type->getAll($cc);
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:7,代码来源:ReportType.php


示例19: toConstraintChain

 public function toConstraintChain()
 {
     $cc = new ConstraintChain();
     if ($this->cleared) {
         return $cc;
     }
     debug('BaseSearch::toConstraintChain Fields: ' . print_r($this->fields, true));
     // Certain hidden fields need to be excluded from the constraint
     foreach ($this->fields as $group => $group_data) {
         foreach ($group_data as $field => $searchField) {
             if ($field == 'purchase_order_number') {
                 $search_value = $searchField->getValue();
                 if (!empty($search_value)) {
                     $invoices = PInvoice::getInvoices($searchField->getValue());
                     if (!empty($invoices)) {
                         $cc->add(new Constraint('id', 'in', '(' . implode(',', array_keys($invoices)) . ')'));
                     }
                 }
             } elseif ($searchField->doConstraint()) {
                 $c = $searchField->toConstraint();
                 if ($c !== false) {
                     $cc->add($c);
                 }
             }
         }
     }
     debug('BaseSearch::toConstraintChain Constraints: ' . print_r($cc, true));
     return $cc;
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:29,代码来源:pinvoicesSearch.php


示例20: reset_passwords

 public function reset_passwords()
 {
     if (!isset($this->_data['users'])) {
         $user = DataObjectFactory::Factory('User');
         $cc = new ConstraintChain();
         $cc->add(new Constraint('usercompanyid', '=', EGS_COMPANY_ID));
         $results = $user->getAll($cc);
         $this->view->set('users', $results);
     } else {
         foreach ($this->_data['users'] as $username) {
             $user = DataObjectFactory::Factory('User');
             $user->load($username);
             $password = '';
             if (isset($this->_data['password'])) {
                 $password = $this->_data['password'];
             }
             $password = $user->setPassword($password);
             $message = "Your password for " . SERVER_ROOT . " has been reset\n" . "Your username is {$user->username}\n" . "Your password is {$password}\n" . "Thank you";
             $subject = 'Password reset';
             $person = DataObjectFactory::Factory('Person');
             $person->load($user->person_id);
             $to = $person->email->contactmethod;
             $headers = 'From: ' . get_config('ADMIN_EMAIL') . "\r\n" . 'X-Mailer: PHP/' . phpversion();
             if ($to != '') {
                 mail($to, $subject, $message, $headers);
             }
         }
         sendBack();
     }
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:30,代码来源:UsersController.php



注:本文中的ConstraintChain类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Consulta类代码示例发布时间:2022-05-23
下一篇:
PHP Constants类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap