function action_content_type_title($content_type) { if (!$content_type) { drupal_not_found(); } return t('Manage Purge Settings for !content_type', array('!content_type' => $content_type->name)); }
public function submit($form, &$form_state) { if (!isset($form_state['build_info']['args'][0]) || !is_object($form_state['build_info']['args'][0]) || get_class($form_state['build_info']['args'][0]) != 'Drupal\\ablecore_menu\\MenuPathRelationship') { drupal_not_found(); } $relationship = $form_state['build_info']['args'][0]; $relationship->delete(); drupal_set_message('Relationship deleted successfully!'); drupal_goto('admin/config/ablecore/menu-relationships'); }
function action_delete($identifier) { // Load the item. $relationship = MenuPathRelationship::load($identifier); if ($relationship === false) { drupal_not_found(); return ''; } // Prepare the form. return drupal_get_form('ablecore_menu_delete_relationship', $relationship); }
public function build($form, &$form_state) { if (empty($form_state['build_info']['args'][0]->type)) { drupal_not_found(); return false; } $content_type = $form_state['build_info']['args'][0]->type; // Update the form state storage with the current list of paths // if we don't have one already. if (!isset($form_state['storage']['paths'])) { $form_state['storage']['paths'] = publisher_purge_get_content_type_paths($content_type); } $form['#tree'] = true; $form['paths'] = array(); foreach ($form_state['storage']['paths'] as $index => $path) { $form['paths'][$index] = array('path' => array('#markup' => check_plain($path)), 'delete' => array('#type' => 'submit', '#value' => t('Delete'), '#name' => 'delete-path-' . $index, '#ajax' => array('callback' => '\\Drupal\\publisher_purge\\Forms\\ConfigureContentTypeForm::ajaxCallbackDelete', 'wrapper' => 'path-container'), '#validate' => array('\\Drupal\\publisher_purge\\Forms\\ConfigureContentTypeForm::deletePath'), '#executes_submit_callback' => false)); } $form['add_path'] = array('#type' => 'fieldset', '#title' => t('Add Path'), 'path' => array('#type' => 'textfield', '#title' => t('Path'), '#description' => t('Enter a path to purge when a node of this content type is updated.')), 'add' => array('#type' => 'submit', '#value' => t('Add'), '#name' => 'add-path', '#ajax' => array('callback' => '\\Drupal\\publisher_purge\\Forms\\ConfigureContentTypeForm::ajaxCallbackAdd', 'wrapper' => 'path-container'), '#validate' => array('\\Drupal\\publisher_purge\\Forms\\ConfigureContentTypeForm::addPath'), '#executes_submit_callback' => false, '#limit_validation_errors' => null)); $form['actions'] = array('#type' => 'actions'); $form['actions']['submit'] = array('#type' => 'submit', '#value' => t('Save Configuration')); return $form; }
function gg_view_assignment_listing($section_id, $asec_id) { if (!gg_in_section($section_id)) { return drupal_not_found(); } $asec = AssignmentSection::find($asec_id); $section = $asec->section()->first(); if ((int) $section->section_id !== (int) $section_id) { return drupal_not_found(); } $assignment = $asec->assignment()->first(); drupal_set_title($assignment->assignment_title); $createProblems = WorkflowTask::whereIn('workflow_id', function ($query) use($asec_id) { $query->select('workflow_id')->from('workflow')->where('assignment_id', '=', $asec_id); })->whereType('edit problem')->whereStatus('complete')->get(); $headers = ['Problem']; $rows = []; if (count($createProblems) > 0) { foreach ($createProblems as $t) { $rows[] = [sprintf('<a href="%s">%s</a>', url('class/workflow/' . $t->workflow_id), word_limiter($t->data['problem'], 20))]; } } $return = ''; // Back Link $return .= sprintf('<p><a href="%s">%s %s</a>', url('class/assignments'), HTML_BACK_ARROW, t('Back to Assignment List in Everyone\'s Work')); // Course/section/semester $course = $section->course()->first(); $semester = $section->semester()->first(); $return .= sprintf('<p><strong>%s</strong>: %s — %s — %s', t('Course'), $course->course_name, $section->section_name, $semester->semester_name); // Assignment Description $return .= sprintf('<p class="summary">%s</p>', nl2br($assignment->assignment_description)); $return .= '<hr />'; // Instructions $return .= sprintf('<p>%s <em>%s</em><p>', t('Select a question to see the work on that question so far.'), t('Note that you will not be allowed to see some work in progress.')); $return .= theme('table', array('header' => $headers, 'rows' => $rows, 'empty' => 'No problems found.', 'attributes' => array('width' => '100%'))); return $return; }
<?php // $Id: index.php,v 1.82.4.1 2006/10/18 20:14:08 killes Exp $ /** * @file * The PHP page that serves all page requests on a Drupal installation. * * The routines here dispatch control to the appropriate handler, which then * prints the appropriate page. */ include_once 'includes/bootstrap.inc'; drupal_page_header(); include_once 'includes/common.inc'; fix_gpc_magic(); /* Disabled by AstBill Team - Uvaraj Not compatible med AstBill. Fix to come soon.*/ //drupal_check_token(); $status = menu_execute_active_handler(); switch ($status) { case MENU_NOT_FOUND: drupal_not_found(); break; case MENU_ACCESS_DENIED: drupal_access_denied(); break; } drupal_page_footer();
/** * Implements hook_preprocess_templatename() to render the Person Training records fileds * @todo : translation update */ function covidien_theme_preprocess_person_training_record_node_form(&$vars) { global $user; drupal_add_js(drupal_get_path('theme', 'covidien_theme') . '/js/covidien.js'); drupal_add_js(drupal_get_path('module', 'covidien_users') . '/js/covidien_users.js'); $title = ($vars['form']['nid']['#value'] == "") ? t("Add Training Record") : t("Edit Training Record"); $button_title = ($vars['form']['nid']['#value'] == "") ? t("Add Record") : t("Save Changes"); drupal_set_title($title); $vars['form']['buttons']['submit']['#value'] = $button_title; $id = trim(arg(3)); if (empty($id)) { drupal_not_found(); exit; } $result = node_load($id); $vars['user_id'] = $result->title; $vars['form']['title']['#value'] = "Training Record"; $vars['form']['field_device_type']['nid']['nid']['#title'] = ""; $vars['form']['field_training_completion_date'][0]['value']['#title'] = ""; $vars['form']['field_training_completion_date'][0]['value']['date']['#maxlength'] = "10"; $vars['form']['users_product_line']['#options'] = array_reverse($vars['form']['users_product_line']['#options'], true); $vars['form']['users_product_line']['#options'][''] = ''; $vars['form']['users_product_line']['#options'] = array_reverse($vars['form']['users_product_line']['#options'], true); $vars['form']['field_active_flag']['value']['#title'] = ""; $vars['form']['field_training_completion_date'][0]['value']['date']['#description'] = ''; $vars['form']['field_trainer_id']['nid']['nid']['#title'] = ""; $vars['form']['field_trainee_id']['nid']['nid']['#title'] = ""; $vars['form']['users_product_line']['#attributes'] = array('onchange' => 'getDeviceTypeList(this)'); $vars['form']['device_type_list']['#attributes'] = array('onchange' => 'getTrainersList(this)'); if ($vars['form']['field_device_type']['nid']['nid']['#value']) { $plnid = node_load($vars['form']['field_device_type']['nid']['nid']['#value']); $vars['form']['device_type_list']['#options'] = PLbasedDeviceType($plnid->field_device_product_line[0]['nid']); $vars['form']['device_type_list']['#value'] = $vars['form']['field_device_type']['nid']['nid']['#value']; } if ($vars['form']['field_trainer_id']['nid']['nid']['#value']) { $vars['form']['trainer_list']['#options'] = DeviceTypebasedUsers($vars['form']['field_device_type']['nid']['nid']['#value']); $vars['form']['trainer_list']['#value'] = $vars['form']['field_trainer_id']['nid']['nid']['#value']; } $vars['form']['field_active_flag']['value']['#options'][''] = ""; if ($vars['form']['nid']['#value'] != "") { $trainerid = $vars['form']['field_trainer_id']['nid']['nid']['#value']; $vars['form']['field_trainer_id']['nid']['nid']['#attributes'] = array("disabled" => "disabled"); $vars['form']['trainer_list']['#attributes'] = array("disabled" => "disabled"); $plvalue = node_load($vars['form']['field_device_type']['nid']['nid']['#value']); $vars['form']['users_product_line']['#value'] = $plvalue->field_device_product_line[0]['nid']; $vars['form']['users_product_line']['#attributes'] = array("disabled" => "disabled"); $trainerid_opt = array($trainerid => $vars['form']['field_trainer_id']['nid']['nid']['#options'][$trainerid]); $vars['form']['field_trainer_id']['nid']['nid']['#options'] = $trainerid_opt; $dtypeid = $vars['form']['field_device_type']['nid']['nid']['#value']; $vars['form']['field_device_type']['nid']['nid']['#attributes'] = array("disabled" => "disabled"); $vars['form']['device_type_list']['#attributes'] = array("disabled" => "disabled"); $dtypeid_opt = array($dtypeid => $vars['form']['field_device_type']['nid']['nid']['#options'][$dtypeid]); $vars['form']['field_device_type']['nid']['nid']['#options'] = $dtypeid_opt; $vars['form']['field_training_completion_date'][0]['value']['date']['#attributes'] = array("disabled" => "disabled"); } else { $vars['form']['field_trainer_id']['nid']['nid']['#options'][''] = ""; //Blank option at first $vars['form']['field_device_type']['nid']['nid']['#options'] = array_reverse($vars['form']['field_device_type']['nid']['nid']['#options'], true); $vars['form']['field_device_type']['nid']['nid']['#options'][''] = ""; $vars['form']['field_device_type']['nid']['nid']['#options'] = array_reverse($vars['form']['field_device_type']['nid']['nid']['#options'], true); // // $vars['form']['field_training_completion_date'][0]['value']['date']['#attributes'] = array("readonly"=>"readonly"); } $vars['form']['field_trainee_id']['nid']['nid']['#options'][''] = ""; $vars['form']['device_type_list']['#options'][''] = ""; $vars['form']['trainer_list']['#options'][''] = ""; $vars['form']['field_trainee_id']['nid']['nid']['#value'] = $id; $vars['username'] = $result->field_first_name[0]['value'] . ' ' . $result->field_last_name[0]['value']; $vars['trainer'] = drupal_render($vars['form']['field_trainer_id']); $vars['active_flag'] = drupal_render($vars['form']['field_active_flag']); $vars['training_completion_date'] = drupal_render($vars['form']['field_training_completion_date']); $vars['device_type'] = drupal_render($vars['form']['field_device_type']); $vars['form']['buttons']['submit']['#attributes'] = array('onclick' => '$("#trainer_list,#device_type_list").attr("disabled","disabled");'); $vars['save'] = drupal_render($vars['form']['buttons']['submit']); $vars['delete'] = drupal_render($vars['form']['buttons']['delete']); $vars['user_pl'] = drupal_render($vars['form']['users_product_line']); $vars['trainer_list'] = drupal_render($vars['form']['trainer_list']); $vars['device_type_list'] = drupal_render($vars['form']['device_type_list']); $vars['render'] = drupal_render($vars['form']); }
protected function getRemote($form_state) { // Check to see if we have a remote. /** @var Remote $remote */ $remote = null; if (!empty($form_state['build_info']['args'][0]) && $form_state['build_info']['args'][0] instanceof Remote) { $remote = $form_state['build_info']['args'][0]; } // If we don't have a remote, 404. if (!$remote) { watchdog('publisher_entity_tracking', 'Remote not specified or invalid.'); drupal_not_found(); return array(); } return $remote; }
function sopac_lists_listing_page($uid = 0) { global $user; $insurge = sopac_get_insurge(); $sopac_admin = user_access('administer sopac'); $account = user_load($uid); if (empty($account->uid)) { drupal_not_found(); exit; } else { $output .= "<p style=\"float: right\">" . l('See all Public Lists...', 'user/lists/public') . '</p>'; $output .= "<h1>Lists for {$account->name}</h1>"; // display lists $res = db_query("SELECT * FROM {sopac_lists} WHERE uid = %d", $account->uid); while ($list = db_fetch_array($res)) { if ($sopac_admin || $list['public']) { $list['items'] = $insurge->get_list_items($list['list_id']); $output .= theme('sopac_list', $list); $lists_displayed = TRUE; } } if (!$lists_displayed) { $output .= '<p>This user has no lists to display.</p>'; } } return $output; }