Ejemplo n.º 1
0
 /**
  * Return the javascript to create an instance of the class defined in formJavascriptClass
  *
  * @param   object  $params  plugin parameters
  * @param   object  $model   list model
  * @param   array   $args    array [0] => string table's form id to contain plugin
  *
  * @return bool
  */
 public function onLoadJavascriptInstance($params, $model, $args)
 {
     parent::onLoadJavascriptInstance($params, $model, $args);
     FabrikHelperHTML::script('media/com_fabrik/js/element.js');
     $listModel = JModel::getInstance('list', 'FabrikFEModel');
     $listModel->setId(JRequest::getVar('listid'));
     $elements = $model->getElements('safecolname');
     $pels = $params->get('inline_editable_elements');
     $use = json_decode($pels);
     if (!is_object($use)) {
         $aEls = trim($pels) == '' ? array() : explode(",", $pels);
         $use = new stdClass();
         foreach ($aEls as $e) {
             $use->{$e} = array($e);
         }
     }
     $els = array();
     $srcs = array();
     $test = (array) $use;
     if (!empty($test)) {
         foreach ($use as $key => $fields) {
             $trigger = $elements[$key];
             $els[$key] = new stdClass();
             $els[$key]->elid = $trigger->_id;
             $els[$key]->plugins = array();
             foreach ($fields as $field) {
                 $val = $elements[$field];
                 // Load in all element js classes
                 if (is_object($val)) {
                     $val->formJavascriptClass($srcs);
                     $els[$key]->plugins[$field] = $val->getElement()->id;
                 }
             }
         }
     } else {
         foreach ($elements as $key => $val) {
             $key = FabrikString::safeColNameToArrayKey($key);
             $els[$key] = new stdClass();
             $els[$key]->elid = $val->_id;
             $els[$key]->plugins = array();
             $els[$key]->plugins[$key] = $val->getElement()->id;
             // Load in all element js classes
             $val->formJavascriptClass($srcs);
         }
     }
     FabrikHelperHTML::script($srcs);
     $opts = $this->getElementJSOptions($model);
     $opts->elements = $els;
     $opts->formid = $model->getFormModel()->getId();
     $opts->focusClass = 'focusClass';
     $opts->editEvent = $params->get('inline_edit_event', 'dblclick');
     $opts->tabSave = $params->get('inline_tab_save', false);
     $opts->showCancel = $params->get('inline_show_cancel', true);
     $opts->showSave = (bool) $params->get('inline_show_save', true);
     $opts->loadFirst = (bool) $params->get('inline_load_first', false);
     $opts = json_encode($opts);
     $formid = 'list_' + $model->getFormModel()->getForm()->id;
     $this->jsInstance = "new FbListInlineEdit({$opts})";
     return true;
 }
Ejemplo n.º 2
0
Archivo: php.php Proyecto: rw1/fabrik
 /**
  * return the javascript to create an instance of the class defined in formJavascriptClass
  * @param object parameters
  * @param object table model
  * @param array [0] => string table's form id to contain plugin
  * @return bool
  */
 function onLoadJavascriptInstance($params, $model, $args)
 {
     parent::onLoadJavascriptInstance($params, $model, $args);
     $opts = $this->getElementJSOptions($model);
     $opts = json_encode($opts);
     $this->jsInstance = "new FbListPHP({$opts})";
     return true;
 }
Ejemplo n.º 3
0
 /**
  * return the javascript to create an instance of the class defined in formJavascriptClass
  * @param object parameters
  * @param object table model
  * @param array [0] => string table's form id to contain plugin
  * @return bool
  */
 function onLoadJavascriptInstance($params, $model, $args)
 {
     parent::onLoadJavascriptInstance($params, $model, $args);
     $opts = new stdClass();
     $opts->name = $this->_getButtonName();
     $opts->listid = $model->getId();
     $opts = json_encode($opts);
     $this->jsInstance = "new fbTableRunPHP({$opts})";
     return true;
 }
Ejemplo n.º 4
0
	/**
	 * return the javascript to create an instance of the class defined in formJavascriptClass
	 * @param object parameters
	 * @param object table model
	 * @param array [0] => string table's form id to contain plugin
	 * @return bool
	 */

	function onLoadJavascriptInstance($params, $model, $args)
	{
		parent::onLoadJavascriptInstance($params, $model, $args);
		$opts = new stdClass();
		$opts->name = $this->_getButtonName();
		$opts->listid = $model->getId();
		$opts->renderOrder = $this->renderOrder;
		$opts = json_encode($opts);
		$this->jsInstance = "new FbListEmail($opts)";
		return true;
	}
Ejemplo n.º 5
0
	/**
	 * return the javascript to create an instance of the class defined in formJavascriptClass
	 * @param object parameters
	 * @param list table model
	 * @param array [0] => string table's form id to contain plugin
	 * @return bool
	 */

	function onLoadJavascriptInstance($params, $model, $args)
	{
		parent::onLoadJavascriptInstance($params, $model, $args);
		FabrikHelperHTML::addStyleDeclaration('.focusClass{border:1px solid red !important;}');
		FabrikHelperHTML::script('media/com_fabrik/js/element.js');
		$listModel = JModel::getInstance('list', 'FabrikFEModel');
		$listModel->setId(JRequest::getVar('listid'));

		$elements = $model->getElements('filtername');
		$pels = $params->get('inline_editable_elements');
		$use = trim($pels) == '' ? array() : explode(",", $pels);
		$els = array();
		$srcs = array();
		foreach ($elements as $key => $val) {
			$key = FabrikString::safeColNameToArrayKey($key);
			if (empty($use) || in_array($key, $use)) {
				$els[$key] = new stdClass();
				$els[$key]->elid = $val->_id;
				$els[$key]->plugin = $val->getElement()->plugin;
				//load in all element js classes
				$val->formJavascriptClass($src);
			}
		}
		FabrikHelperHTML::script($srcs, true);
		$opts = new stdClass();
		$opts->elements = $els;
		$opts->listid = $model->getId();
		$opts->focusClass = 'focusClass';
		$opts->editEvent = $params->get('inline_edit_event', 'dblclick');
		$opts->tabSave = $params->get('inline_tab_save', false);
		$opts->showCancel = $params->get('inline_show_cancel', true);
		$opts->showSave = $params->get('inline_show_save', true);
		$opts->loadFirst = (bool)$params->get('inline_load_first', false);
		$opts = json_encode($opts);
		$formid = 'list_'+$model->getFormModel()->getForm()->id;
		$this->jsInstance = "new FbListInlineEdit($opts)";
		return true;
	}
Ejemplo n.º 6
0
 /**
  * Get the button label
  *
  * @return  string
  */
 protected function buttonLabel()
 {
     return $this->getParams()->get('button_label', parent::buttonLabel());
 }
Ejemplo n.º 7
0
 /**
  * return tehe javascript to create an instance of the class defined in formJavascriptClass
  * @param string table's form id to contain plugin
  * @return string javascript to create instance. Instance name must be 'el'
  */
 function onLoadJavascriptInstance($formid)
 {
     parent::onLoadJavascriptInstance($params, $model, $args);
     $opts = new stdClass();
     $opts->listid = $model->getId();
     $opts = json_encode($opts);
     return "new fbTableExample('{$formid}', {$opts})";
 }
Ejemplo n.º 8
0
 /**
  * return the javascript to create an instance of the class defined in formJavascriptClass
  * @param	object	parameters
  * @param	object	table model
  * @param	array	[0] => string table's form id to contain plugin
  * @return	bool
  */
 function onLoadJavascriptInstance($params, $model, $args)
 {
     parent::onLoadJavascriptInstance($params, $model, $args);
     $opts = $this->getElementJSOptions($model);
     $opts->requireChecked = false;
     $opts = json_encode($opts);
     $this->jsInstance = "new FbListWebservice({$opts})";
     return true;
 }
Ejemplo n.º 9
0
 /**
  * Get the src(s) for the list plugin js class
  *
  * @return  mixed  string or array
  */
 public function loadJavascriptClass_result()
 {
     $src = parent::loadJavascriptClass_result();
     return array($src, 'media/com_fabrik/js/element.js');
 }
Ejemplo n.º 10
0
 /**
  * load the javascript class that manages interaction with the form element
  * should only be called once
  * @return string javascript class file
  */
 function loadJavascriptClass()
 {
     $el = $this->getPlaceElement();
     $mapelement = $this->getMapElement();
     if (!is_object($mapelement)) {
         return;
     }
     $opts = array();
     $opts['container'] = 'radius_search_place_container';
     $listid = $this->model->get('id');
     $formid = $this->model->getFormModel()->get('id');
     $shortkey = $el->getElement()->name;
     if (!is_object($mapelement)) {
         JError::raiseNotice(500, JText::_('Radius search plug-in active but map element unpublished'));
         return;
     }
     $mapfullkey = $mapelement->getFullName(false, true, false);
     FabrikHelperHTML::autoComplete("radius_search_place{$this->_counter}", $el->getElement()->id, $el->_pluginName, $opts);
     FabrikHelperHTML::script('components/com_fabrik/libs/geo-location/geo.js');
     parent::loadJavascriptClass();
 }
Ejemplo n.º 11
0
 /**
  * Return the javascript to create an instance of the class defined in formJavascriptClass
  *
  * @param   array  $args  Array [0] => string table's form id to contain plugin
  *
  * @return bool
  */
 public function onLoadJavascriptInstance($args)
 {
     parent::onLoadJavascriptInstance($args);
     $opts = $this->getElementJSOptions();
     $params = $this->getParams();
     $opts->js_code = $params->get('table_php_js_code', '');
     $opts->requireChecked = (bool) $params->get('table_php_require_checked', '1');
     $opts = json_encode($opts);
     $this->jsInstance = "new FbListPhp({$opts})";
     return true;
 }
Ejemplo n.º 12
0
 /**
  * Prep the button if needed
  *
  * @param   object  $params  plugin params
  * @param   object  &$model  list model
  * @param   array   &$args   arguements
  *
  * @return  bool;
  */
 public function button($params, &$model, &$args)
 {
     parent::button($params, $model, $args);
     return true;
 }
Ejemplo n.º 13
0
 /**
  * Return the javascript to create an instance of the class defined in formJavascriptClass
  *
  * @param   object  $params  plugin parameters
  * @param   object  $model   list model
  * @param   array   $args    array [0] => string table's form id to contain plugin
  *
  * @return bool
  */
 public function onLoadJavascriptInstance($params, $model, $args)
 {
     parent::onLoadJavascriptInstance($params, $model, $args);
     if (!is_object($this->getMapElement())) {
         return false;
     }
     $opts = $this->getElementJSOptions($model);
     $opts->steps = (int) $params->get('radius_max', 100);
     $opts->unit = $params->get('radius_unit', 'km');
     $opts->value = $this->getValue();
     $opts = json_encode($opts);
     $this->jsInstance = "new FbListRadiusSearch({$opts})";
     return true;
 }
Ejemplo n.º 14
0
 /**
  * return the javascript to create an instance of the class defined in formJavascriptClass
  * @param object parameters
  * @param list table model
  * @param array [0] => string table's form id to contain plugin
  * @return bool
  */
 function onLoadJavascriptInstance($params, $model, $args)
 {
     parent::onLoadJavascriptInstance($params, $model, $args);
     $opts = $this->getElementJSOptions($model);
     $opts = json_encode($opts);
     return "new FbListExample('{$formid}', {$opts})";
 }