本文整理汇总了PHP中Flash::Instance方法的典型用法代码示例。如果您正苦于以下问题:PHP Flash::Instance方法的具体用法?PHP Flash::Instance怎么用?PHP Flash::Instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Flash
的用法示例。
在下文中一共展示了Flash::Instance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
$flash = Flash::Instance();
// Preserve any search criteria selection so that the context is maintained
$s_data = array();
if (isset($this->_data['id'])) {
$s_data['wh_transfer_id'] = $this->_data['id'];
}
$this->view->set('clickaction', 'view');
$whtransfer = new WHTransfer();
$whtransfer->load($this->_data['id']);
$this->view->set('whtransfer', $whtransfer);
$from_store = WHLocation::getStoreLocation($whtransfer->from_whlocation_id);
$this->view->set('from_store', $from_store);
$to_store = WHLocation::getStoreLocation($whtransfer->to_whlocation_id);
$this->view->set('to_store', $to_store);
$this->setSearch('whtransfersSearch', 'useDefault', $s_data);
parent::index(new WHTransferlineCollection($this->_templateobject));
$sidebar = new SidebarController($this->view);
$sidebarlist = array();
$sidebarlist['all'] = array('tag' => 'View All Transfers', 'link' => array_merge($this->_modules, array('controller' => 'WHTransfers', 'action' => 'index')));
if ($whtransfer->awaitingTransfer()) {
$sidebarlist['edit'] = array('tag' => 'Edit this Transfer', 'link' => array_merge($this->_modules, array('controller' => 'WHTransfers', 'action' => 'edit', 'id' => $whtransfer->id)));
$sidebarlist['cancel'] = array('tag' => 'Cancel this Transfer', 'link' => array_merge($this->_modules, array('controller' => 'WHTransfers', 'action' => 'cancel', 'id' => $whtransfer->id)));
}
$sidebar->addList('Actions', $sidebarlist);
$this->view->register('sidebar', $sidebar);
$this->view->set('sidebar', $sidebar);
}
示例2: save
public function save()
{
$flash = Flash::Instance();
$errors = array();
$data = $this->_data[$this->modeltype];
$obj = '';
if (!empty($data['task_id'])) {
$obj = new Task();
$obj->load($data['task_id']);
} elseif (!empty($data['project_id'])) {
$obj = new Project();
$obj->load($data['project_id']);
}
if ($obj instanceof DataObject && $obj->isLoaded()) {
if (fix_date($data['start_date']) < $obj->start_date) {
$errors['start_date'] = 'Start date before ' . get_class($obj) . ' start date';
}
if (fix_date($data['end_date']) > $obj->end_date) {
$errors['end_date'] = 'End date after ' . get_class($obj) . ' end date';
}
}
if (!empty($data['person_id']) && $data['quantity'] > 1) {
$errors['person_id'] = 'Quantity must be 1 for a person';
}
if (count($errors) == 0 && parent::save($this->modeltype, '', $errors)) {
sendBack();
} else {
$flash->addErrors($errors);
$this->refresh();
}
}
示例3: populate
function populate()
{
if (!isModuleAdmin()) {
$flash = Flash::Instance();
$flash->addError('You don\'t have permission to view the Sales Team summary EGlets');
$this->should_render = false;
return false;
}
$db =& DB::Instance();
$query = 'SELECT s.id,s.name FROM opportunitystatus s WHERE usercompanyid=' . $db->qstr(EGS_COMPANY_ID) . ' ORDER BY position DESC';
$statuses = $db->GetAssoc($query);
$query = 'SELECT DISTINCT assigned FROM opportunities o WHERE o.usercompanyid=' . EGS_COMPANY_ID . ' AND extract(\'' . $this->timeframe . '\' FROM o.enddate)=extract(\'' . $this->timeframe . '\' FROM now())';
$users = $db->GetCol($query);
$options = array();
foreach ($users as $username) {
if (empty($username)) {
continue;
}
$data = array();
foreach ($statuses as $id => $status) {
$query = 'SELECT COALESCE(sum(cost),0) FROM opportunities o WHERE o.assigned=' . $db->qstr($username) . ' AND o.status_id=' . $db->qstr($id) . ' AND o.usercompanyid=' . EGS_COMPANY_ID . ' AND extract(\'' . $this->timeframe . '\' FROM o.enddate)=extract(\'' . $this->timeframe . '\' FROM now())';
$data['x'][] = $status;
$data['y'][] = (double) $db->GetOne($query);
}
$options['seriesList'][] = array('label' => $username, 'legendEntry' => TRUE, 'data' => $data);
}
if (!isset($options['seriesList']) || empty($options['seriesList'])) {
return false;
}
$options['type'] = 'bar';
$options['identifier'] = __CLASS__ . $this->timeframe;
$this->contents = json_encode($options);
}
示例4: save
public function save()
{
$flash = Flash::Instance();
$errors = array();
$partyaddress = $this->_uses[$this->modeltype];
if (!empty($this->_data[$this->modeltype][$partyaddress->idField])) {
// This is an update to an existing party address/address
// so check if the address is used by other parties
// - update it if address is only used by this party
// - insert it if the current address is used by other parties and it does not already exist
// - otherwise, no need to do anything here (but see below)
if ($partyaddress->load($this->_data[$this->modeltype][$partyaddress->idField])) {
$partyaddress->checkAddress($this->_data);
} else {
$errors[] = 'Error loading current Address details ' . $db->errorMsg();
}
}
if (isset($this->_data['Address'])) {
// Check if this address exists; if it does, point the PartyAddress to it
// and remove the input address as it does not need inserting/updating
$address = DataObjectFactory::Factory('Address');
$address->check_exists($this->_data['Address']);
if ($address->isLoaded()) {
unset($this->_data['Address']);
$this->_data[$this->modeltype]['address_id'] = $address->{$address->idField};
}
}
if (count($errors) == 0 && parent::save($this->modeltype)) {
sendTo($_SESSION['refererPage']['controller'], $_SESSION['refererPage']['action'], $_SESSION['refererPage']['modules'], isset($_SESSION['refererPage']['other']) ? $_SESSION['refererPage']['other'] : null);
} else {
$flash->addErrors($errors);
$this->refresh();
}
}
示例5: _new
public function _new()
{
$flash = Flash::Instance();
parent::_new();
$gl_params = $this->_uses[$this->modeltype];
$unassigned = $gl_params->unassignedParams();
if (count($unassigned) > 0) {
$this->view->set('unassigned', $unassigned);
} elseif (count($unassigned) == 0 && $this->_data['action'] == 'new') {
$flash->addMessage('All parameters have been assigned');
sendTo($this->name, 'index', $this->_modules);
} elseif ($this->_data['action'] == 'new') {
$flash->addError('Error getting Parameter List');
sendback();
}
if (isset($_POST[$this->modeltype]['paramdesc'])) {
$this->selectlist($_POST[$this->modeltype]['paramdesc']);
} elseif ($gl_params->isLoaded()) {
$this->selectlist($gl_params->paramdesc);
$this->view->set('selected', $gl_params->paramvalue_id);
} else {
$this->selectlist(key($unassigned));
}
$sidebar = new SidebarController($this->view);
$sidebarlist = array();
$sidebarlist['view'] = array('tag' => 'View Parameters', 'link' => array_merge($this->_modules, array('controller' => $this->name, 'action' => 'index')));
$sidebar->addList('Actions', $sidebarlist);
$this->view->register('sidebar', $sidebar);
$this->view->set('sidebar', $sidebar);
}
示例6: 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');
}
示例7: _new
public function _new()
{
$flash = Flash::Instance();
$errors = array();
$glaccounts = new GLAccount();
if ($glaccounts->getCount() == 0) {
$errors[] = 'No GL Accounts defined';
}
$glcentres = new GLCentre();
if ($glcentres->getCount() == 0) {
$errors[] = 'No GL Centres defined';
}
if (count($errors) > 0) {
$flash->addErrors($errors);
sendback();
}
parent::_new();
$currency = $this->_uses[$this->modeltype];
$glaccounts = $glaccounts->getAll();
if (isset($_POST[$this->modeltype]['writeoff_glaccount_id'])) {
$default_glaccount_id = $_POST[$this->modeltype]['writeoff_glaccount_id'];
} elseif (isset($this->_data['writeoff_glaccount_id'])) {
$default_glaccount_id = $this->_data['writeoff_glaccount_id'];
} elseif ($currency->isLoaded()) {
$default_glaccount_id = $currency->writeoff_glaccount_id;
} else {
$default_glaccount_id = key($glaccounts);
}
$this->view->set('glcentres', $this->getCentres($default_glaccount_id));
}
示例8: save
public function save()
{
if (!$this->checkParams($this->modeltype)) {
sendBack();
}
$flash = Flash::Instance();
$errors = array();
$contains = array();
foreach ($this->_data[$this->modeltype] as $key => $packinglist) {
if (is_array($packinglist) && isset($packinglist['contains'])) {
if ($packinglist['contains'] > $packinglist['available']) {
$errors[] = 'Pack qty for ' . $key . ' exceeds that available for packing';
} else {
$contains[$key] = $packinglist['contains'];
}
}
}
$this->_data[$this->modeltype]['contents'] = base64_encode(serialize($contains));
if (count($errors) == 0 && parent::save($this->modeltype)) {
sendTo('sorders', 'view', $this->_modules, array('id' => $this->_data[$this->modeltype]['order_id']));
} else {
$flash->addErrors($errors);
$this->_data['order_id'] = $this->_data[$this->modeltype]['order_id'];
$this->refresh();
}
}
示例9: view
public function view()
{
$flash = Flash::Instance();
// Preserve any search criteria selection so that the context is maintained
$s_data = array();
if (isset($this->_data['id'])) {
$s_data['wh_transfer_id'] = $this->_data['id'];
}
$whtransfer = new WHTransfer();
$whtransfer->load($this->_data['id']);
$this->view->set('whtransfer', $whtransfer);
$from_store = WHLocation::getStoreLocation($whtransfer->from_whlocation_id);
$this->view->set('from_store', $from_store);
$to_store = WHLocation::getStoreLocation($whtransfer->to_whlocation_id);
$this->view->set('to_store', $to_store);
$this->setSearch('whtransfersSearch', 'useDefault', $s_data);
parent::index(new WHTransferlineCollection($this->_templateobject));
$sidebar = new SidebarController($this->view);
$sidebarlist = array();
$sidebarlist['awaiting'] = array('link' => array_merge($this->_modules, array('controller' => 'WHTransfers', 'action' => 'selectWHTransfers')), 'tag' => 'View Transfers Awaiting Despatch');
$sidebarlist['completed'] = array('link' => array_merge($this->_modules, array('controller' => 'WHTransfers', 'action' => 'viewWHTransfers')), 'tag' => 'View Completed Transfers');
if ($whtransfer->awaitingTransfer()) {
$sidebarlist['edit'] = array('link' => array_merge($this->_modules, array('controller' => 'WHTransfers', 'action' => 'transferStock', 'id' => $whtransfer->id)), 'tag' => 'Action this Transfer');
}
if ($whtransfer->transferred()) {
$sidebarlist['edit'] = array('link' => array_merge($this->_modules, array('controller' => 'WHTransfers', 'action' => 'printaction', 'printaction' => 'printTransferNote', 'filename' => 'WHT' . $whtransfer->transfer_number, 'id' => $whtransfer->id)), 'tag' => 'Reprint Transfer Note');
}
$sidebar->addList('Actions', $sidebarlist);
$this->view->register('sidebar', $sidebar);
$this->view->set('sidebar', $sidebar);
}
示例10: save
public function save()
{
$flash = Flash::Instance();
if (parent::save('Address')) {
sendTo($_SESSION['refererPage']['controller'], $_SESSION['refererPage']['action'], $_SESSION['refererPage']['modules'], isset($_SESSION['refererPage']['other']) ? $_SESSION['refererPage']['other'] : null);
}
$this->refresh();
}
示例11: save
public function save()
{
$flash = Flash::Instance();
if (parent::save('ComplaintVolume')) {
sendTo($this->name, 'index', $this->_modules);
}
$this->refresh();
}
示例12: save
public function save()
{
$flash = Flash::Instance();
if (parent::save($this->modeltype)) {
sendTo($this->name, 'index', $this->_modules);
}
$this->refresh();
}
示例13: index
public function index()
{
$glparams = DataObjectFactory::Factory('GLParams');
if (is_null($glparams->ar_disposals_proceeds_account()) || is_null($glparams->ar_disposals_proceeds_centre()) || is_null($glparams->ar_pl_suspense_account()) || is_null($glparams->ar_pl_suspense_centre())) {
$flash = Flash::Instance();
$flash->addError('GL Support is not enabled');
}
parent::index();
}
示例14: smarty_function_flash
function smarty_function_flash($params, &$smarty)
{
$flash = Flash::Instance();
$flash->restore();
$data = array('messages' => $flash->messages, 'warnings' => $flash->warnings, 'errors' => $flash->errors);
$flash->clear();
// fetch smarty plugin template
return smarty_plugin_template($smarty, $data, 'function.flash');
}
示例15: save
public function save()
{
$flash = Flash::Instance();
if (parent::save('CSFailureCode')) {
sendTo($this->name, 'index', $this->_modules);
} else {
$this->refresh();
}
}