ajaxForm() static public method

This function provides a mecanism to send html form by ajax
static public ajaxForm ( $selector, $success = "console.log(html);" )
Esempio n. 1
0
 /**
  * Display form after selecting date range in planning
  *
  * @since 9.1
  *
  * @param $params (array): must contains this keys :
  *  - begin : start of selection range.
  *       (should be an ISO_8601 date, but could be anything wo can be parsed by strtotime)
  *  - end : end of selection range.
  *       (should be an ISO_8601 date, but could be anything wo can be parsed by strtotime)
  *
  * @return Nothing (display function)
  */
 static function showAddEventSubForm($params = array())
 {
     $rand = mt_rand();
     $params['begin'] = date("Y-m-d H:i:s", strtotime($params['begin']));
     $params['end'] = date("Y-m-d H:i:s", strtotime($params['end']));
     if ($item = getItemForItemtype($params['itemtype'])) {
         $item->showForm('', array('from_planning_ajax' => true, 'begin' => $params['begin'], 'end' => $params['end'], 'formoptions' => "id='ajax_reminder{$rand}'"));
         $callback = "\$('.ui-dialog-content').dialog('close');\n                      \$('#planning').fullCalendar('refetchEvents');\n                      displayAjaxMessageAfterRedirect();";
         Html::ajaxForm("#ajax_reminder{$rand}", $callback);
     }
 }