本文整理汇总了PHP中add_message函数的典型用法代码示例。如果您正苦于以下问题:PHP add_message函数的具体用法?PHP add_message怎么用?PHP add_message使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了add_message函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processView
function processView()
{
$this->_search_params = array();
if (!empty($_REQUEST['name'])) {
$_REQUEST['family_name'] = $_REQUEST['name'];
}
foreach ($this->_search_terms as $term) {
if (!empty($_REQUEST[$term])) {
$this->_search_params[$term] = $_REQUEST[$term];
}
}
if (!empty($this->_search_params)) {
$this->_family_data = $GLOBALS['system']->getDBObjectData('family', $this->_search_params, 'AND', 'family_name');
}
if (empty($this->_family_data) && !empty($this->_search_params['family_name'])) {
$this->_search_params['family_name'] = '%' . $this->_search_params['family_name'] . '%';
$this->_family_data = $GLOBALS['system']->getDBObjectData('family', $this->_search_params, 'AND', 'family_name');
}
if (count($this->_family_data) == 1) {
add_message('One matching family found');
redirect('families', array('familyid' => key($this->_family_data), 'name' => NULL));
//exits
}
// Put all the archived ones last
$archiveds = array();
foreach ($this->_family_data as $k => $v) {
if ($v['status'] == 'archived') {
$archiveds[$k] = $v;
unset($this->_family_data[$k]);
}
}
foreach ($archiveds as $k => $v) {
$this->_family_data[$k] = $v;
}
}
示例2: index
public function index($assignment_id)
{
require_capability('servicequotes:writesqs');
if (!($assignment = $this->assignment_model->get($assignment_id))) {
die("The assignment ID {$assignment_id} could not be found!");
}
$this->assignment = $this->assignment_model->get($assignment_id);
if (empty($this->assignment)) {
add_message('This job is no longer on record.', 'warning');
redirect(base_url());
}
$order = $this->order_model->get($this->assignment->order_id);
$order_type = $this->order_model->get_type_string($order->order_type_id);
parent::update_time($order->id);
$diagnostics = $this->diagnostic_model->get_for_technician($this->assignment, $this->session->userdata('technician_id'), $order->senior_technician_id);
$diagnostic = reset($diagnostics);
$tasks = $this->order_model->get_tasks($order->id);
$this->load->library('Miniant_Workflow_manager', array(), 'workflow_manager');
$this->workflow_manager->initialise(array('workflow' => $order_type, 'stage' => 'postjob_checklist', 'param' => $assignment_id, 'module' => 'miniant'));
$title_options = array('title' => $order_type . ' post-job checklist', 'help' => 'You must complete these tasks before obtaining the client\'s signature', 'icons' => array());
$complete = $this->order_model->has_statuses($order->id, array('POST-JOB COMPLETE'));
if (!$complete) {
add_message('You must complete all the tasks below before moving to the next section', 'warning');
}
$this->load_stage_view(array('tasks' => $tasks, 'completed' => $complete));
}
示例3: processView
/**
* Load up a template object and save its details if applicable.
*/
function processView()
{
if (isset($_REQUEST['templateid'])) {
$this->_template = new Note_Template((int) $_REQUEST['templateid']);
if ($this->_template->id) {
$this->_template->acquireLock();
}
}
if (!empty($_POST['delete'])) {
$this->_template->delete();
add_message("Template deleted");
redirect($_REQUEST['view'], array('*' => NULL));
// exits
}
if (!empty($_REQUEST['template_submitted'])) {
$this->_template->processForm();
if ($this->_template->id) {
if ($this->_template->save()) {
add_message("Template saved");
redirect($_REQUEST['view'], array('*' => NULL));
}
} else {
if ($this->_template->create()) {
add_message("Template added");
redirect($_REQUEST['view'], array('*' => NULL));
}
}
}
}
示例4: processView
function processView()
{
if ($_REQUEST['personid']) {
$this->_person = new Person((int) $_REQUEST['personid']);
}
if (empty($this->_person)) {
trigger_error("Person not found", E_USER_ERROR);
}
// exits
$this->_staff_member = $GLOBALS['system']->getDBObject('staff_member', $this->_person->id);
if (empty($this->_staff_member) && !empty($_POST['confirm_delete'])) {
// delete the person altogether
$this->_person->delete();
} else {
if (!empty($_POST['confirm_archiveclean'])) {
// archive and anononmize the person
if (!$this->_person->aquireLock()) {
add_message('This person cannot be deleted because somebody else holds the lock. Try again later.', 'error');
redirect('persons', array('personid' => $this->_person->id));
// exits
}
$this->_person->archiveAndClean();
add_message($this->_person->toString() . ' has been archived and cleaned', 'success');
redirect('persons', array('personid' => $this->_person->id));
// exits
}
}
}
示例5: processView
function processView()
{
if (empty($_REQUEST['familyid'])) {
trigger_error("Cannot add note, no family ID specified", E_USER_WARNING);
return;
}
$this->_family =& $GLOBALS['system']->getDBObject('family', $_REQUEST['familyid']);
$GLOBALS['system']->includeDBClass('family_note');
$this->_note = new Family_Note();
if (array_get($_REQUEST, 'new_note_submitted')) {
$this->_note->processForm();
$this->_note->setValue('familyid', $this->_family->id);
if ($this->_note->create()) {
add_message('Note added');
redirect('families', array('familyid' => $this->_family->id), 'note_' . $this->_note->id);
// exits
}
} else {
$members = $this->_family->getMemberData();
if (count($members) == 1) {
add_message('Family has only one member, so adding note to that person instead');
redirect('_add_note_to_person', array('personid' => key($members)));
// exits
}
}
}
示例6: processView
function processView()
{
$this->_loadPerson();
if (array_get($_POST, 'action')) {
if (!$this->person->acquireLock()) {
add_message("Could not adjust iCal feed at this time; please try again later", 'error');
return;
}
if ($_POST['action'] == 'enable') {
$this->person->setFeedUUID();
$message = 'iCal feed enabled';
} else {
if ($_POST['action'] == 'change') {
$this->person->setFeedUUID();
$message = 'iCal URL changed';
} else {
if ($_POST['action'] == 'disable') {
$this->person->setValue('feed_uuid', NULL);
$message = 'iCal feed disabled';
} else {
$message = 'Invalid action';
}
}
}
if (!$this->person->save(FALSE)) {
add_message("Could not adjust iCal feed at this time; please try again later", 'error');
return;
}
$this->person->releaseLock();
add_message($message);
}
}
示例7: process
public function process()
{
$assignment_id = $this->input->post('assignment_id');
$assignment = $this->assignment_model->get($assignment_id);
$unit = $this->unit_model->get($assignment->unit_id);
$order = (object) $this->order_model->get_values($assignment->order_id);
$form_data = $this->get_form_data($this->input->post('unit_type_id'), $assignment_id, $this->input->post(), true);
$order_type = $this->order_model->get_type_string($order->order_type_id);
$this->load->library('Miniant_Workflow_manager', array(), 'workflow_manager');
$this->workflow_manager->initialise(array('workflow' => $order_type, 'stage' => 'unit_serial', 'param' => $assignment_id, 'module' => 'miniant'));
foreach ($form_data['required'] as $field => $description) {
$this->form_validation->set_rules($field, $description, 'trim|required');
}
$success = $this->form_validation->run();
if (!$success) {
add_message('The form could not be submitted. Please check the errors below', 'danger');
return $this->index($assignment_id);
}
$unit_id = $this->unit_model->merge_if_serial_exists($form_data['fields'], $assignment_id);
if ($unit_id != $assignment->unit_id) {
add_message('The serial number you entered matches an existing unit. Please review the details below and answer the questions at the bottom of the form', 'warning');
}
trigger_event('unit_serial_entered', 'assignment', $assignment_id, false, 'miniant');
redirect($this->workflow_manager->get_next_url());
}
示例8: processView
function processView()
{
if (empty($_REQUEST['planid'])) {
add_message('No plans selected for execution', 'error');
return;
}
if (empty($_REQUEST['personid'])) {
add_message('No persons selected for plan execution', 'error');
return;
}
$plans = array();
foreach ($_REQUEST['planid'] as $planid) {
$plans[] = $GLOBALS['system']->getDBObject('action_plan', $planid);
}
$refdate = process_widget('plan_reference_date', array('type' => 'date'));
foreach ($_REQUEST['personid'] as $personid) {
foreach ($plans as $plan) {
$plan->execute('person', (int) $personid, $refdate);
}
}
foreach ($plans as $plan) {
add_message('"' . $plan->getValue('name') . '" plan executed for ' . count($_REQUEST['personid']) . ' person(s)', 'success');
}
if (count($_REQUEST['personid']) == 1) {
redirect('persons', array('personid' => (int) reset($_REQUEST['personid'])));
}
}
示例9: processView
function processView()
{
$GLOBALS['system']->includeDBClass('person');
$this->_search_params = array();
$search = trim(array_get($_REQUEST, 'search', array_get($_REQUEST, 'tel', '')));
$tel = preg_replace('/[^0-9]/', '', $search);
if ($search == '') {
return;
}
if (!empty($tel)) {
// Look for phone number matches
$this->_family_data = $GLOBALS['system']->getDBObjectData('family', array('home_tel' => $tel));
$this->_person_data = $GLOBALS['system']->getDBObjectData('person', array('mobile_tel' => $tel, 'work_tel' => $tel));
}
if (empty($tel) || empty($this->_family_data) && empty($this->_person_data)) {
// Look for family name, person name, group name or person email
$this->_family_data = $GLOBALS['system']->getDBObjectData('family', array('family_name' => $search . '%'));
$this->_person_data = Person::getPersonsByName($search);
$this->_group_data = $GLOBALS['system']->getDBObjectData('person_group', array('name' => $search . '%'), 'OR', 'name');
if (FALSE !== strpos($search, '@')) {
// Add email search
$this->_person_data += $GLOBALS['system']->getDBObjectData('person', array('email' => $search));
}
if (empty($this->_group_data)) {
$this->_group_data = $GLOBALS['system']->getDBObjectData('person_group', array('name' => '%' . $search . '%'), 'OR', 'name');
}
}
$numResults = count($this->_family_data) + count($this->_group_data) + count($this->_person_data);
if ($numResults == 1) {
// For a single result, just redirect to its detail view, don't show a list
if (!empty($this->_person_data)) {
add_message("One matching person found");
redirect('persons', array('search' => NULL, 'personid' => key($this->_person_data)));
} else {
if (!empty($this->_family_data)) {
add_message("One matching family found");
redirect('families', array('search' => NULL, 'familyid' => key($this->_family_data)));
} else {
if (!empty($this->_group_data)) {
add_message("One matching group found");
redirect('groups', array('search' => NULL, 'groupid' => key($this->_group_data)));
}
}
}
}
// Put all archived results at the end of the list
foreach (array('_person_data', '_family_data', '_group_data') as $var) {
$archiveds = array();
$ref =& $this->{$var};
foreach ($ref as $k => $v) {
if (array_get($v, 'status') == 'archived' || array_get($v, 'is_archived')) {
$archiveds[$k] = $v;
unset($ref[$k]);
}
}
foreach ($archiveds as $k => $v) {
$ref[$k] = $v;
}
}
}
示例10: delete_attachment
public function delete_attachment($attachment_id, $unit_id, $field_name, $assignment_id)
{
$this->unit_attachment_model->delete($attachment_id);
$this->unit_model->edit($unit_id, array($field_name => null));
add_message('The attachment was successfully deleted');
return $this->index($assignment_id);
}
示例11: processView
function processView()
{
$params = array();
if (!empty($_REQUEST['name'])) {
$GLOBALS['system']->includeDBClass('person');
$this->_person_data = Person::getPersonsByName($_REQUEST['name']);
} else {
foreach ($this->_search_terms as $term) {
if (!empty($_REQUEST[$term])) {
$params[$term] = $_REQUEST[$term];
}
}
if (!empty($params)) {
$this->_person_data = $GLOBALS['system']->getDBObjectData('person', $params, 'AND', 'last_name');
}
}
if (count($this->_person_data) == 1) {
add_message('One matching person found');
redirect('persons', array('name' => NULL, 'personid' => key($this->_person_data)));
}
$archiveds = array();
foreach ($this->_person_data as $k => $v) {
if ($v['status'] == 'archived') {
$archiveds[$k] = $v;
unset($this->_person_data[$k]);
}
}
foreach ($archiveds as $k => $v) {
$this->_person_data[$k] = $v;
}
}
示例12: processView
function processView()
{
$this->_family =& $GLOBALS['system']->getDBObject('family', $_REQUEST['familyid']);
$GLOBALS['system']->includeDBClass('person');
$this->_person = new Person();
if (array_get($_REQUEST, 'new_person_submitted')) {
$GLOBALS['system']->doTransaction('begin');
$this->_person = new Person();
$this->_person->processForm();
$this->_person->setValue('familyid', $this->_family->id);
if ($this->_person->create()) {
if (!empty($_POST['execute_plan'])) {
foreach ($_POST['execute_plan'] as $planid) {
$plan = $GLOBALS['system']->getDBObject('action_plan', $planid);
$plan->execute('person', $this->_person->id, process_widget('plan_reference_date', array('type' => 'date')));
}
}
$GLOBALS['system']->doTransaction('commit');
add_message('New family member added');
redirect('families', array('familyid' => $this->_family->id));
// exits
} else {
$GLOBALS['system']->doTransaction('rollback');
}
} else {
$this->_person->setValue('last_name', $this->_family->getValue('family_name'));
}
}
示例13: processView
function processView()
{
if (empty($_POST['personid'])) {
trigger_error("Cannot update persons, no person ID specified", E_USER_WARNING);
return;
}
$customValues = array();
$customFields = $GLOBALS['system']->getDBObjectData('custom_field', array(), 'OR', 'rank');
$dummyField = new Custom_Field();
foreach ($customFields as $fieldid => $fieldDetails) {
$dummyField->populate($fieldid, $fieldDetails);
if ($val = $dummyField->processWidget()) {
$customValues[$fieldid] = $val;
}
}
foreach ($this->_allowedFields as $field) {
if (array_get($_POST, $field, '') == '') {
unset($_POST[$field]);
}
}
if (empty($customValues) && count(array_intersect(array_keys($_POST), $this->_allowedFields)) == 0) {
add_message("Cannot update; no new values were specified", 'error');
if (!empty($_REQUEST['backto'])) {
parse_str($_REQUEST['backto'], $back);
unset($back['backto']);
redirect($back['view'], $back);
}
return;
}
$success = 0;
$GLOBALS['system']->setFriendlyErrors(TRUE);
foreach ((array) $_REQUEST['personid'] as $personid) {
$this->_person = new Person((int) $personid);
foreach ($this->_allowedFields as $field) {
if (isset($_POST[$field])) {
$this->_person->setValue($field, $_POST[$field]);
}
}
foreach ($customValues as $fieldid => $val) {
$this->_person->setCustomValue($fieldid, $val, array_get($_POST, 'custom_' . $fieldid . '_add', FALSE));
}
if ($this->_person->validateFields() && $this->_person->save()) {
$success++;
}
}
if ($success == count($_REQUEST['personid'])) {
add_message('Fields updated for ' . count($_REQUEST['personid']) . ' persons');
} else {
if ($success > 0) {
add_message("Fields updated for {$success} persons; some persons could not be updated");
} else {
add_message('There was a problem updating the fields. Check your selected persons.');
}
}
if (!empty($_REQUEST['backto'])) {
parse_str($_REQUEST['backto'], $back);
unset($back['backto']);
redirect($back['view'], $back);
}
}
示例14: processView
function processView()
{
if (empty($_REQUEST['personid'])) {
trigger_error("Cannot add note, no person ID specified", E_USER_WARNING);
return;
}
if (!is_array($_REQUEST['personid'])) {
$this->_person =& $GLOBALS['system']->getDBObject('person', $_REQUEST['personid']);
$_REQUEST['personid'] = array($_REQUEST['personid']);
}
$GLOBALS['system']->includeDBClass('person_note');
$this->_note = new Person_Note();
if (array_get($_REQUEST, 'new_note_submitted')) {
$this->_note->processForm();
$success = TRUE;
foreach ($_REQUEST['personid'] as $personid) {
$this->_note->id = 0;
$this->_note->setValue('personid', $personid);
$success = $success && $this->_note->create();
}
if ($success) {
if ($this->_person) {
add_message('Note added');
redirect('persons', array('personid' => $this->_person->id), 'note_' . $this->_note->id);
// exits
} else {
add_message('Note added to ' . count($_REQUEST['personid']) . ' persons');
redirect('home');
}
}
}
}
示例15: processView
function processView()
{
if (!empty($_POST['datetypename'])) {
$to_add = $to_delete = $to_update = array();
foreach ($_POST['datetypename'] as $id => $name) {
if ($id == '_new_') {
foreach ($name as $n) {
if ($n) {
$to_add[] = $n;
}
}
} else {
if ($name) {
$to_update[$id] = $name;
}
}
}
foreach ($to_update as $id => $name) {
$SQL = 'UPDATE date_type
SET name = ' . $GLOBALS['db']->quote($name) . '
WHERE id = ' . (int) $id;
$res = $GLOBALS['db']->query($SQL);
check_db_result($res);
}
$res = $GLOBALS['db']->query('DELETE FROM date_type WHERE id NOT IN (' . implode(',', array_merge(array_keys($to_update))) . ')');
foreach ($to_add as $name) {
$SQL = 'INSERT INTO date_type (name)
VALUES (' . $GLOBALS['db']->quote($name) . ')';
$res = $GLOBALS['db']->query($SQL);
check_db_result($res);
}
add_message("Date types updated");
}
}