本文整理汇总了PHP中DataObjectCollection类的典型用法代码示例。如果您正苦于以下问题:PHP DataObjectCollection类的具体用法?PHP DataObjectCollection怎么用?PHP DataObjectCollection使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DataObjectCollection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: populate
function populate()
{
$po_obj = new DataObject('po_no_auth_user');
$po_obj->idField = 'id';
$po_obj->identifierField = 'order_number';
$po_col = new DataObjectCollection($po_obj);
$po_col->setParams();
$sh = new SearchHandler($po_col, false);
$sh->setFields(array('id', 'order_number', 'supplier', 'status'));
$sh->addConstraint(new Constraint('status', '!=', 'X'));
$this->setSearchLimit($sh);
$sh->setOrderby(array('order_date', 'due_date', 'order_number'));
$po_col->load($sh);
$this->contents = $po_col;
}
示例2: _new
public function _new()
{
parent::_new();
$this->setTemplateName('calls_new');
$projects = $opportunities = $activities = null;
if (isset($this->_data['person_id'])) {
$person = new Person();
$person->load($this->_data['person_id']);
$this->_data['company_id'] = $person->company_id;
$projects = $person->projects;
$opportunities = $person->opportunities;
$activities = $person->activities;
$this->view->set('person', $person->fullname);
}
if (isset($this->_data['company_id'])) {
$company = new Company();
$company->load($this->_data['company_id']);
$projects = DataObjectCollection::Merge($company->projects, $projects);
$opportunities = DataObjectCollection::Merge($company->opportunities, $opportunities);
$activities = DataObjectCollection::Merge($company->activities, $activities);
$this->view->set('company', $company->name);
}
if (isset($this->_data['project_id'])) {
$project = new Project();
$project->load($this->_data['project_id']);
$this->_data['company_id'] = $project->company_id;
}
$this->view->set('projects', $projects);
$this->view->set('opportunities', $opportunities);
$this->view->set('activities', $activities);
}
示例3: save
public function save()
{
$flash = Flash::Instance();
if (strtolower($this->_data['saveform']) == 'cancel') {
$flash->addMessage('Action cancelled');
sendTo($this->name, 'index', $this->_modules);
}
$errors = array();
$db = DB::Instance();
$db->StartTrans();
$header_data = $this->_data['WHTransfer'];
$lines_data = array();
if (isset($this->_data['WHTransferLine'])) {
$lines_data = $this->_data['WHTransferLine'];
$lines_data = DataObjectCollection::joinArray($lines_data);
} else {
$errors[] = 'No Transfer Lines entered';
}
if (isset($header_data['id']) && $header_data['id'] != '') {
$action = 'updated';
// delete any lines not submitted
$update = array();
foreach ($lines_data as $line) {
$update[$line['id']] = $line['id'];
}
$whtransfer = new WHTransfer();
$whtransfer->load($header_data['id']);
if ($whtransfer) {
foreach ($whtransfer->transfer_lines as $line) {
if (!isset($update[$line->id])) {
$whtransferline = new WHTransferline();
$whtransferline->delete($line->id);
}
}
}
} else {
$action = 'added';
}
$whtransfer = WHTransfer::Factory($header_data, $lines_data, $errors);
if ($whtransfer && count($errors) == 0) {
$whtransfer->save($errors);
}
if (count($errors) == 0 && $db->CompleteTrans()) {
$flash->addMessage('Transfer Number ' . $whtransfer->transfer_number . ' ' . $action . ' successfully');
sendTo($this->name, 'index', $this->_modules);
} else {
$db->FailTrans();
$flash->addErrors($errors);
$this->_new();
$this->_templateName = $this->getTemplateName('new');
}
}
示例4: __construct
public function __construct(DataObjectCollection $collection, $use_session = TRUE, $use_system_company = TRUE, $search_id = '')
{
$tablename = $collection->getViewName();
$this->tablename = $tablename;
$this->use_session = $use_session;
$this->search_id = $search_id;
$this->constraints = new ConstraintChain();
$this->use_system_company = $use_system_company;
$this->setOrderby($collection->orderby, $collection->direction);
if (strpos($tablename, ' ')) {
$this->tablename = substr($tablename, strrpos($tablename, ' ') + 1);
}
$cache_id = array('searches', EGS_USERNAME, $this->tablename . '_' . $this->search_id);
$cache = Cache::Instance();
$cached_search = $cache->get($cache_id, 1800);
if ($this->use_session && $cached_search !== FALSE) {
foreach ($cached_search as $key => $val) {
if ($key == 'constraints' || $key == 'fields') {
$this->{$key} = unserialize($val);
} else {
$this->{$key} = $val;
}
}
debug('SearchHandler::__construct ' . $tablename . ' ' . print_r($this, TRUE));
// echo 'SearchHandler::__construct<pre>'.print_r($this, true).'</pre>';
} elseif ($this->use_system_company) {
//if usercompanyid is a field, then it's always a constraint
// TODO: Need to revisit this;
// gets added in DataObject(?)/DataObjectCollection(?)
// if the search is access controlled
$model = $collection->getModel();
if ($model->isField('usercompanyid')) {
$this->constraints = new ConstraintChain();
$this->addConstraint(new Constraint('usercompanyid', '=', EGS_COMPANY_ID));
}
}
$this->collection = $collection;
}
示例5: save
public function save()
{
if (!$this->CheckParams($this->modeltype)) {
sendBack();
}
if (!empty($this->_data['MFDowntimeCode']['id'])) {
$mfdowntimecode = $this->_uses[$this->modeltype];
$mfdowntimecode->load($this->_data['MFDowntimeCode']['id']);
if ($mfdowntimecode->isLoaded()) {
foreach ($mfdowntimecode->mf_centres as $mfcentredowntimecode) {
$mfcentredowntimecode->delete();
}
}
}
if (isset($this->_data['MFCentreDowntimeCode'])) {
$mfcentredowntimecode = DataObjectCollection::joinarray($this->_data['MFCentreDowntimeCode']);
unset($this->_data['MFCentreDowntimeCode']);
foreach ($mfcentredowntimecode as $key => $data) {
$this->_data[$key]['MFCentreDowntimeCode'] = $data;
}
}
parent::save();
}
示例6: array
function __construct($do = 'GLPeriod', $tablename = 'gl_periods')
{
parent::__construct($do, $tablename);
$this->orderby = array('year', 'period');
$this->direction = array('DESC', 'DESC');
$this->_identifierField = 'year || \' - period \' || period';
}
示例7: array
function __construct($do = 'ProjectEquipment', $tablename = 'project_equipment_allocation_overview')
{
// Contruct the object
parent::__construct($do, $tablename);
// Set specific characteristics
$this->identifierField = 'name';
$this->orderby = array('start_date', 'equipment');
}
示例8:
function __construct($do = 'GLParams', $tablename = 'gl_params')
{
parent::__construct($do, $tablename);
$this->_identifierField = "paramvalue";
}
示例9:
function __construct($do = 'PLPayment', $tablename = 'pl_payments_overview')
{
parent::__construct($do, $tablename);
}
示例10:
function __construct($do = 'ComplaintType')
{
parent::__construct($do);
}
示例11:
function __construct($do = 'Permission', $tablename = 'permissions')
{
parent::__construct($do, $tablename);
$this->orderby = 'position';
}
示例12: array
function __construct($do = 'GLTransaction', $tablename = 'gltransactionsoverview')
{
parent::__construct($do, $tablename);
$this->orderby = array('glperiod', 'account', 'cost_centre');
}
示例13: array
function __construct($do = 'SInvoiceLine', $tablename = 'customer_service')
{
parent::__construct($do, $tablename);
$this->orderby = array('product_group', 'customer', 'stitem', 'due_despatch_date');
$this->direction = array('ASC', 'ASC', 'ASC', 'DESC');
}
示例14:
function __construct($do = 'SOrder', $tablename = 'so_headeroverview')
{
parent::__construct($do, $tablename);
$this->view = '';
}
示例15:
function __construct($do = 'DatasetField')
{
parent::__construct($do);
$this->orderby = 'position';
}