Beispiel #1
0
 public function action_saver($route_id, &$data, $args)
 {
     if (isset($_POST['string'])) {
         $sess = new midcom_core_services_sessioning();
         $sess->set("string", $_POST['string']);
         echo $_POST['string'];
     }
 }
Beispiel #2
0
 /**
  * Store unshown UI messages from the stack to user session.
  */
 public function store()
 {
     if (count($this->message_stack) == 0) {
         // No unshown messages
         return true;
     }
     // We have to be careful what messages to store to session to prevent them
     // from accumulating
     $messages_to_store = array();
     foreach ($this->message_stack as $id => $message) {
         // Check that the messages were not coming from earlier session
         if (!in_array($id, $this->messages_from_session)) {
             $messages_to_store[$id] = $message;
         }
     }
     if (count($messages_to_store) == 0) {
         // We have only messages coming from earlier sessions, and we ditch those
         return true;
     }
     $session = new midcom_core_services_sessioning('midcom_services_uimessages');
     // Check if some other request has added stuff to session as well
     if ($session->exists('midcom_services_uimessages_stack')) {
         $old_stack = $session->get('midcom_services_uimessages_stack');
         $messages_to_store = array_merge($old_stack, $messages_to_store);
     }
     $session->set('midcom_services_uimessages_stack', $messages_to_store);
     $this->message_stack = array();
 }