Beispiel #1
0
 public function _on_watched_dba_create($object)
 {
     $ret = array();
     //Check if we have data in session, if so use that.
     $session = new midcom_services_session('org.openpsa.relatedto');
     if ($session->exists('relatedto2get_array')) {
         $relatedto_arr = $session->get('relatedto2get_array');
         $session->remove('relatedto2get_array');
     } else {
         $relatedto_arr = org_openpsa_relatedto_plugin::get2relatedto();
     }
     foreach ($relatedto_arr as $k => $rel) {
         $ret[$k] = array('stat' => false, 'method' => false, 'obj' => false);
         $rel->fromClass = get_class($object);
         $rel->fromGuid = $object->guid;
         if (!$rel->id) {
             $ret[$k]['method'] = 'create';
             $ret[$k]['stat'] = $rel->create();
         } else {
             //In theory we should not ever hit this, but better to be sure.
             $ret[$k]['method'] = 'update';
             $ret[$k]['stat'] = $rel->update();
         }
         $ret[$k]['obj'] = $rel;
     }
 }
Beispiel #2
0
 /**
  * When syncing data we clear the capatcha data in the session.
  */
 function sync_type_with_widget($results)
 {
     $session = new midcom_services_session($this->_session_domain);
     $session->remove($this->_session_key);
 }
Beispiel #3
0
 /**
  * Initialize the message stack on service start-up. Reads older unshown
  * messages from user session.
  */
 function initialize()
 {
     if (midcom::get('auth')->can_user_do('midcom:ajax', null, 'midcom_services_uimessages')) {
         midcom::get('head')->enable_jquery();
         midcom::get('head')->add_jsfile(MIDCOM_STATIC_URL . '/midcom.services.uimessages/jquery.midcom_services_uimessages.js');
         midcom::get('head')->add_jsfile(MIDCOM_STATIC_URL . '/jQuery/jquery.timers.src.js');
         midcom::get('head')->add_jsfile(MIDCOM_JQUERY_UI_URL . '/ui/jquery.ui.effect.min.js');
         midcom::get('head')->add_jsfile(MIDCOM_JQUERY_UI_URL . '/ui/jquery.ui.effect-pulsate.min.js');
         midcom::get('head')->add_stylesheet(MIDCOM_STATIC_URL . '/midcom.services.uimessages/growl.css', 'screen');
     } else {
         midcom::get('head')->add_stylesheet(MIDCOM_STATIC_URL . '/midcom.services.uimessages/simple.css', 'screen');
     }
     // Read messages from session
     $session = new midcom_services_session('midcom_services_uimessages');
     if ($session->exists('midcom_services_uimessages_stack')) {
         // We've got old messages in the session
         $stored_messages = $session->get('midcom_services_uimessages_stack');
         $session->remove('midcom_services_uimessages_stack');
         if (!is_array($stored_messages)) {
             return false;
         }
         foreach ($stored_messages as $message) {
             $id = $this->add($message['title'], $message['message'], $message['type']);
             $this->_messages_from_session[] = $id;
         }
     }
 }
Beispiel #4
0
 /**
  * Clean up after get2session() (in case we cancel or something)
  *
  * To be used in case we do not get to call on_created_handle_relatedto()
  * or some other method that reads and saves the data (and while at it cleans
  * up after itself)
  */
 function get2session_cleanup()
 {
     $session = new midcom_services_session('org.openpsa.relatedto');
     if ($session->exists('relatedto2get_array')) {
         $session->remove('relatedto2get_array');
     }
 }