本文整理汇总了PHP中sendBack函数的典型用法代码示例。如果您正苦于以下问题:PHP sendBack函数的具体用法?PHP sendBack怎么用?PHP sendBack使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sendBack函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: view
public function view()
{
if (!$this->loadData()) {
$this->dataError();
sendBack();
}
$transaction = $this->_uses[$this->modeltype];
$id = $transaction->id;
$this->view->set('transaction', $transaction);
$elements = new MFCentreCollection(new MFCentre());
$sh = $this->setSearchHandler($elements);
$sh->addConstraint(new Constraint('mfdept_id', '=', $id));
parent::index($elements, $sh);
$sidebar = new SidebarController($this->view);
$sidebarlist = array();
$sidebarlist['all'] = array('tag' => 'All Departments', 'link' => array_merge($this->_modules, array('controller' => $this->name, 'action' => 'index')));
$sidebar->addList('Show', $sidebarlist);
$sidebarlist = array();
$sidebarlist['edit'] = array('tag' => 'Edit', 'link' => array_merge($this->_modules, array('controller' => $this->name, 'action' => 'edit', 'id' => $id)));
if ($elements->count() == 0) {
$sidebarlist['delete'] = array('tag' => 'Delete', 'link' => array_merge($this->_modules, array('controller' => $this->name, 'action' => 'delete', 'id' => $id)));
}
$sidebarlist['add'] = array('tag' => 'Add Centre', 'link' => array_merge($this->_modules, array('controller' => 'MFCentres', 'action' => 'new', 'mfdept_id' => $id)));
$sidebar->addList('This Department', $sidebarlist);
$this->view->register('sidebar', $sidebar);
$this->view->set('sidebar', $sidebar);
$this->view->set('clickaction', 'view');
$this->view->set('clickcontroller', 'MFCentres');
}
示例2: _new
public function _new()
{
$flash = Flash::Instance();
parent::_new();
// Get the Purchase Invoice Line Object - if loaded, this is an edit
$pinvoiceline = $this->_uses[$this->modeltype];
if (!$pinvoiceline->isLoaded()) {
if (empty($this->_data['invoice_id'])) {
$flash->addError('No Purchase Invoice supplied');
sendBack();
}
$pinvoiceline->invoice_id = $this->_data['invoice_id'];
} else {
}
$pinvoice = DataObjectFactory::Factory('Pinvoice');
$pinvoice->load($pinvoiceline->invoice_id);
if (isset($this->_data[$this->modeltype])) {
// We've had an error so refresh the page
$pinvoiceline->line_number = $this->_data['PInvoiceLine']['line_number'];
$_glaccount_id = $this->_data['PInvoiceLine']['glaccount_id'];
} elseif ($pinvoiceline->isLoaded()) {
$_glaccount_id = $pinvoiceline->glaccount_id;
} else {
$pinvoiceline->due_delivery_date = $pinvoice->due_date;
}
$glaccounts = $this->getAccount();
$this->view->set('glaccount_options', $glaccounts);
if (empty($_glaccount_id)) {
$_glaccount_id = key($glaccounts);
}
$this->view->set('glcentre_options', $this->getCentres($_glaccount_id));
$this->view->set('taxrate_options', $this->getTaxRate());
$this->view->set('pinvoice', $pinvoice);
}
示例3: view
public function view()
{
if (!$this->loadData()) {
$this->dataError();
sendBack();
}
$whbin = $this->_uses[$this->modeltype];
$id = $whbin->id;
$this->view->set('transaction', $whbin);
$whlocation = new WHLocation();
$whlocation->load($whbin->whlocation_id);
$this->view->set('whstore', $whlocation->whstore);
$sidebar = new SidebarController($this->view);
$sidebarlist = array();
$sidebarlist['stores'] = array('tag' => 'All Stores', 'link' => array_merge($this->_modules, array('controller' => 'WHStores', 'action' => 'index')));
$sidebarlist['locations'] = array('tag' => 'Locations for Store ' . $whlocation->whstore, 'link' => array_merge($this->_modules, array('controller' => 'WHLocations', 'action' => 'index', 'id' => $whbin->whlocation_id)));
$sidebarlist['bins'] = array('tag' => 'Bins for Location ' . $whlocation->getIdentifierValue(), 'link' => array_merge($this->_modules, array('controller' => 'WHLocations', 'action' => 'view', 'id' => $whbin->whlocation_id)));
$sidebar->addList('Show', $sidebarlist);
$sidebarlist = array();
$sidebarlist['edit'] = array('tag' => 'Edit', 'link' => array_merge($this->_modules, array('controller' => $this->name, 'action' => 'edit', 'id' => $id, 'whlocation_id' => $whbin->whlocation_id)));
// Do not allow delete if balances exist
if ($whbin->balances->count() === 0) {
$sidebarlist['delete'] = array('tag' => 'Delete', 'link' => array_merge($this->_modules, array('controller' => $this->name, 'action' => 'delete', 'id' => $id, 'whlocation_id' => $whbin->whlocation_id)));
}
$sidebar->addList('This Bin', $sidebarlist);
$this->view->register('sidebar', $sidebar);
$this->view->set('sidebar', $sidebar);
}
示例4: view
public function view()
{
if (!$this->loadData()) {
$this->dataError();
sendBack();
}
$accesslist = $this->_uses[$this->modeltype];
// $this->addSidebar($systempolicy);
$policy_permissions = new SystemPolicyControlListCollection();
$sh = $this->setSearchHandler($policy_permissions);
$sh->addConstraint(new Constraint('access_lists_id', '=', $accesslist->{$accesslist->idField}));
parent::index($policy_permissions, $sh);
$this->view->set('no_ordering', true);
$sidebar = new SidebarController($this->view);
$sidebarlist = array();
$sidebarlist['alllists'] = array('link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'index'), 'tag' => 'View All System Access Lists');
$sidebar->addList('Actions', $sidebarlist);
$sidebarlist = array();
$sidebarlist['edit'] = array('link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'edit', 'id' => $accesslist->{$accesslist->idField}), 'tag' => 'edit_access_list');
$sidebarlist['delete'] = array('link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'delete', 'id' => $accesslist->{$accesslist->idField}), 'tag' => 'delete_access_list');
$sidebarlist['addpermission'] = array('link' => array('modules' => $this->_modules, 'controller' => 'systempolicycontrollists', 'action' => '_new', 'object_policies_id' => $accesslist->{$accesslist->idField}), 'tag' => 'add_policy_permission');
$sidebar->addList('This Policy', $sidebarlist);
$this->view->register('sidebar', $sidebar);
$this->view->set('sidebar', $sidebar);
}
示例5: savejournal
public function savejournal()
{
$flash = Flash::Instance();
$errors = array();
if (!$this->checkParams('Vat')) {
sendBack();
}
$data = $this->_data['Vat'];
if ($data['value']['net'] <= 0 || $data['value']['vat'] <= 0) {
$errors[] = 'Net and Vat values must be greater than zero';
} else {
$glparams = DataObjectFactory::Factory('GLParams');
$vat_type = 'vat_' . $data['vat_type'];
$data['vat_account'] = call_user_func(array($glparams, $vat_type));
if ($data['vat_type'] == 'input') {
$data['value']['net'] = bcmul($data['value']['net'], -1);
$data['value']['vat'] = bcmul($data['value']['vat'], -1);
}
$data['transaction_date'] = date(DATE_FORMAT);
$gltransactions = GLTransaction::makeFromVATJournalEntry($data, $errors);
if (count($errors) == 0 && GLTransaction::saveTransactions($gltransactions, $errors)) {
$flash->addMessage('VAT Journal created OK');
sendTo($this->name, '', $this->_modules);
}
}
$flash->addErrors($errors);
$this->_data['vat_type'] = $data['vat_type'];
$this->_data['glaccount_id'] = $data['glaccount_id'];
$this->refresh();
}
示例6: view
public function view()
{
if (!$this->loadData()) {
$this->dataError();
sendBack();
}
$transaction = $this->_uses[$this->modeltype];
$id = $transaction->id;
$this->view->set('transaction', $transaction);
$elements = new WHTransferruleCollection(new WHTransferrule());
$sh = new SearchHandler($elements, false);
$sh->extract();
$sh->addConstraint(new Constraint('whaction_id', '=', $id));
$sh->extractOrdering();
$sh->extractPaging();
$elements->load($sh);
$this->view->set('elements', $elements);
$sidebar = new SidebarController($this->view);
$sidebar->addList('Show', array('all' => array('tag' => 'All Actions', 'link' => array_merge($this->_modules, array('controller' => $this->name, 'action' => 'index'))), 'locations' => array('tag' => 'All Stores', 'link' => array_merge($this->_modules, array('controller' => 'WHStores', 'action' => 'index')))));
$sidebarlist = array();
$sidebarlist['edit'] = array('tag' => 'Edit', 'link' => array_merge($this->_modules, array('controller' => $this->name, 'action' => 'edit', 'id' => $id)));
$sidebarlist['delete'] = array('tag' => 'Delete', 'link' => array_merge($this->_modules, array('controller' => $this->name, 'action' => 'delete', 'id' => $id)));
if (is_null($transaction->max_rules) || $elements->count() < $transaction->max_rules) {
$sidebarlist['Add'] = array('tag' => 'Add Rule', 'link' => array_merge($this->_modules, array('controller' => 'WHTransferrules', 'action' => 'new', 'whaction_id' => $id)));
}
$sidebar->addList('This Action', $sidebarlist);
$this->view->register('sidebar', $sidebar);
$this->view->set('sidebar', $sidebar);
$this->view->set('clickaction', 'view');
$this->view->set('clickcontroller', 'WHTransferrules');
$this->view->set('no_ordering', true);
}
示例7: delete
public function delete()
{
$flash = Flash::Instance();
$errors = array();
$data = array('id' => $this->_data['id'], 'end_date' => date(DATE_FORMAT));
$outside_op = MFOutsideOperation::Factory($data, $errors, 'MFOutsideOperation');
if (count($errors) > 0 || !$outside_op->save()) {
$errors[] = 'Could not delete outside operation';
}
if (count($errors) == 0) {
$stitem = new STItem();
if ($stitem->load($outside_op->stitem_id)) {
//$stitem->calcLatestCost();
if (!$stitem->rollUp(STItem::ROLL_UP_MAX_LEVEL)) {
$errors[] = 'Could not roll-up latest costs';
$db->FailTrans();
}
} else {
$errors[] = 'Could not roll-up latest costs';
$db->FailTrans();
}
}
if (count($errors) == 0) {
$flash->addMessage('Outside operation deleted');
sendTo('STItems', 'viewoutside_operations', $this->_modules, array('id' => $this->_data['stitem_id']));
} else {
$flash->addErrors($errors);
sendBack();
}
}
示例8: view
public function view()
{
if (!$this->loadData()) {
$this->dataError();
sendBack();
}
$transaction = $this->_uses[$this->modeltype];
$id = $transaction->id;
if ($transaction->bin_controlled == 't') {
sendTo('WHBins', 'index', $this->_modules, array('whlocation_id' => $this->_data['id']));
}
$this->view->set('transaction', $transaction);
$sidebar = new SidebarController($this->view);
$sidebarlist = array();
$sidebarlist['stores'] = array('tag' => 'All Stores', 'link' => array_merge($this->_modules, array('controller' => 'WHStores', 'action' => 'index')));
$sidebarlist['locations'] = array('tag' => 'Locations for Store ' . $transaction->whstore, 'link' => array_merge($this->_modules, array('controller' => 'WHStores', 'action' => 'view', 'id' => $transaction->whstore_id)));
$sidebar->addList('Show', $sidebarlist);
$sidebarlist = array();
$sidebarlist['edit'] = array('tag' => 'Edit', 'link' => array_merge($this->_modules, array('controller' => $this->name, 'action' => 'edit', 'id' => $id)));
if ($transaction->isBinControlled() && $transaction->bins->count() == 0 || !$transaction->isBinControlled() && $transaction->balances->count() == 0) {
$sidebarlist['delete'] = array('tag' => 'Delete', 'link' => array_merge($this->_modules, array('controller' => $this->name, 'action' => 'delete', 'id' => $id, 'whstore_id' => $transaction->whstore_id)));
}
$sidebar->addList('This Location', $sidebarlist);
$this->view->register('sidebar', $sidebar);
$this->view->set('sidebar', $sidebar);
$this->view->set('page_title', $this->getPageName('Location'));
}
示例9: view
public function view()
{
if (!$this->loadData()) {
$this->dataError();
sendBack();
}
$mappingrule = $this->_uses[$this->modeltype];
$this->view->set('clickaction', 'view');
$this->view->set('mappingrule', $mappingrule);
$childrules = new DataMappingRuleCollection(new DataMappingRule());
$sh = $this->setSearchHandler($childrules);
$sh->addConstraint(new Constraint('parent_id', '=', $mappingrule->id));
parent::index($childrules, $sh);
$sidebar = new SidebarController($this->view);
$sidebar->addList('actions', array($mappingrule->name => array('tag' => 'View All Mapping Rules', 'link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'index'))));
$sidebarlist = array();
$sidebarlist[$mappingrule->name] = array('tag' => 'view', 'link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'view', 'id' => $mappingrule->id));
$sidebarlist['edit'] = array('tag' => 'edit', 'link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'edit', 'id' => $mappingrule->id));
$sidebarlist['delete'] = array('tag' => 'delete', 'link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'delete', 'id' => $mappingrule->id));
$sidebar->addList($mappingrule->external_system . ' ' . $mappingrule->name, $sidebarlist);
if (!is_null($mappingrule->parent_id)) {
$mappingrule->addLinkRule(array('data_translations' => array()));
}
$this->sidebarRelatedItems($sidebar, $mappingrule);
$this->view->register('sidebar', $sidebar);
$this->view->set('sidebar', $sidebar);
$this->view->set('page_title', $this->getPageName());
}
示例10: 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');
}
示例11: viewperson
public function viewperson()
{
$view = new Newsletterview();
$view->load($this->_data['id']) or sendBack();
$person = new Person();
$person->load($view->person_id);
sendTo('persons', 'view', 'contacts', array('id' => $person->id));
}
示例12: save
public function save()
{
if (!$this->CheckParams($this->modeltype)) {
sendBack();
}
$flash = Flash::Instance();
$errors = array();
$db = DB::Instance();
$db->StartTrans();
$current_accounts = array();
if (isset($this->_data[$this->modeltype]['id'])) {
$centre = $this->_templateobject;
$centre->load($this->_data[$this->modeltype]['id']);
if ($centre->isLoaded()) {
foreach ($centre->accounts as $accountcentre) {
// Delete any existing entries not in the supplied list
if (!empty($this->_data[$this->modeltype]['account_id']) && in_array($accountcentre->glaccount_id, $this->_data[$this->modeltype]['account_id'])) {
$current_accounts[$accountcentre->glaccount_id] = $accountcentre->glaccount_id;
} elseif (!$accountcentre->delete(null, $errors)) {
$errors[] = 'Failed to update Account Centre Reference ' . $accountcentre->glaccount;
}
}
}
}
if (count($errors) === 0 && parent::save_model($this->modeltype)) {
if (isset($this->_data[$this->modeltype]['account_id'])) {
foreach ($this->_data[$this->modeltype]['account_id'] as $account_id) {
if (!key_exists($account_id, $current_accounts)) {
$data = array();
$data['glaccount_id'] = $account_id;
$data['glcentre_id'] = $this->saved_model->id;
$accountcentre = GLAccountCentre::Factory($data, $errors, 'GLAccountCentre');
if ($accountcentre) {
$accountcentre->save();
if (!$accountcentre) {
$errors[] = 'Failed to save reference to Account';
break;
}
} else {
$errors[] = 'Failed to save reference to Account';
break;
}
}
}
}
if (count($errors) == 0) {
$db->CompleteTrans();
sendTo($this->name, 'index', $this->_modules);
}
} else {
$errors[] = 'Failed to save GL Centre';
}
$db->FailTrans();
$flash->addErrors($errors);
$this->refresh();
}
示例13: save
public function save()
{
$flash = Flash::Instance();
if (parent::save('SalesPerson')) {
sendBack();
} else {
$this->_new();
$this->_templateName = $this->getTemplateName('new');
}
}
示例14: delete
public function delete()
{
$flash = Flash::Instance();
if (!isModuleAdmin()) {
$flash->addError('Sorry, must be a module admin to delete resource templates.');
sendBack();
}
parent::delete('Resourcetemplate');
sendTo('resourcetemplate', 'index', 'projects');
}
示例15: save
public function save()
{
$flash = Flash::Instance();
$errors = array();
if (parent::save('ReportDefinition', '', $errors)) {
sendBack();
} else {
$flash->addErrors($errors);
sendBack();
}
}