Beispiel #1
0
 /**
  * Handles the submitted configuration form.
  * This is where the operation can transform and store the submitted data.
  * Only called if the operation is declared as configurable.
  *
  * @param $form
  *   The views form.
  * @param $form_state
  *   An array containing the current state of the form.
  */
 public function formSubmit($form, &$form_state)
 {
     // Some modules (including this one) place their action callbacks
     // into separate files. At this point those files might no longer be
     // included due to a page reload, so we call actions_list() to trigger
     // inclusion. The same thing is done by actions_do() on execute.
     actions_list();
     $submit_callback = $this->operationInfo['callback'] . '_submit';
     $this->formOptions = $submit_callback($form, $form_state);
 }
<?php

page_header("Actions Management");
$op2 = httpget('op2');
if ($op2 == "del") {
    $act = actions_list();
    $key = httpget('key');
    $value = $act[$key];
    output("All values of the action \"" . $value . "\" were deleted.");
    $stamina = db_prefix("stamina");
    db_query("DELETE FROM {$stamina} WHERE action='{$key}'");
    unset($act[$key]);
    set_module_setting("actionsarray", serialize($act), "staminasystem");
    actions_list();
    $actiondebug = get_module_setting("actionsarray", "staminasystem");
    debug($actiondebug);
    addnav("Continue");
    addnav("Continue", "runmodule.php?module=staminasystem&op=superuser");
}
if ($op2 == "new") {
    $new = httppost('action');
    output("The action \"{$new}\" has been added.");
    $act = actions_list();
    $act[] = $new;
    set_module_setting("actionsarray", serialize($act), "staminasystem");
    $act = actions_list();
    addnav("Continue");
    addnav("Continue", "runmodule.php?module=staminasystem&op=superuser");
}
page_footer();
 function getEditFormContent()
 {
     $this->_fetchTaskInformation();
     $query = db_select('trigger_assignments', 'a');
     $query->fields('a', array('hook'));
     $query->fields('b', array('aid', 'label'));
     $query->leftJoin('actions', 'b', 'a.aid=b.aid');
     $query->condition('a.hook', "fire_trigger_task{$this->_task_id}", '=');
     $aa_res = $query->execute();
     $options = array();
     $functions = array();
     $hook = 'fire_trigger_task' . $this->_task_id;
     // Restrict the options list to actions that declare support for this hook.
     foreach (actions_list() as $func => $metadata) {
         if (isset($metadata['triggers']) && array_intersect(array($hook, 'any'), $metadata['triggers'])) {
             $functions[] = $func;
         }
     }
     foreach (actions_get_all_actions() as $aid => $action) {
         if (in_array($action['callback'], $functions)) {
             $options[$action['type']][$aid] = $action['label'];
         }
     }
     return theme('maestro_task_fire_trigger_edit', array('tdid' => $this->_task_id, 'td_rec' => $this->_task_data, 'aa_res' => $aa_res, 'options' => $options));
 }