protected function getInput() { JLoader::register('JEVHelper', JPATH_SITE . "/components/com_jevents/libraries/helper.php"); JEVHelper::ConditionalFields($this->element, $this->form->getName()); if ($this->fieldname == "rp_id") { // The active event id field. if (0 == (int) $this->value) { $value = ''; } else { $value = (int) $this->value; } return '<input type="hidden" id="selectedrepeat" name="' . $this->name . '" value="' . $value . '" />'; } // Load the modal behavior script. JLoader::register('JevModal', JPATH_LIBRARIES . "/jevents/jevmodal/jevmodal.php"); JevModal::modal("a.selectmodal"); $js = "\n\t\tfunction jSelectEvent_" . $this->id . "(link, title, Itemid, evid, rpid) {\n\t\t\tjQuery('#selectedeventtitle').val( title);\n\t\t\tjQuery('#selectedevent').val( evid);\n\t\t\tjQuery('#selectedrepeat').val( rpid);\n\t\t\tjQuery('#selectEvent').modal('hide');\n\t\t\treturn false;\n\t\t}"; // Add the script to the document head. JFactory::getDocument()->addScriptDeclaration($js); // Setup variables for display. $html = array(); $link = 'index.php?option=com_jevents&task=icalevent.select&tmpl=component&' . JSession::getFormToken() . '=1&nomenu=1&function=jSelectEvent_' . $this->id; // get the repeat id $rpidfield = $this->form->getField("rp_id", "request"); $rp_id = $rpidfield->value; $db = JFactory::getDBO(); $db->setQuery('SELECT det.summary as title' . ' FROM #__jevents_vevdetail as det ' . ' LEFT JOIN #__jevents_repetition as rep ON rep.eventdetail_id = det.evdet_id' . ' WHERE rep.rp_id = ' . (int) $rp_id); $title = $db->loadResult(); echo $db->getErrorMsg(); if ($error = $db->getErrorMsg()) { JError::raiseWarning(500, $error); } if (empty($title)) { $title = JText::_('COM_JEVENTS_FIELD_SELECT_EVENT_LABEL'); } $title = htmlspecialchars($title, ENT_QUOTES, 'UTF-8'); // The current user display field. $html[] = '<div class="fltlft input-append" >'; $html[] = ' <input type="text" id="selectedeventtitle" value="' . $title . '" disabled="disabled" size="50" />'; $link = "javascript:jevModalPopup('selectEvent', '" . $link . "', '" . JText::_("COM_JEVENTS_CHANGE_EVENT_BUTTON", array('jsSafe' => true)) . "'); "; // The user select button. $html[] = ' <a class="selectmodal btn btn-primary" title="' . JText::_('COM_JEVENTS_CHANGE_EVENT') . '" href="' . $link . '" ><span class="icon-list icon-white"></span>' . JText::_('COM_JEVENTS_CHANGE_EVENT_BUTTON') . '</a>'; $html[] = '</div>'; // The active event id field. if (0 == (int) $this->value) { $value = ''; } else { $value = (int) $this->value; } // class='required' for client side validation $class = ''; if ($this->required) { $class = ' class="required modal-value"'; } $html[] = '<input type="hidden" id="selectedevent" ' . $class . ' name="' . $this->name . '" value="' . $value . '" />'; return implode("\n", $html); }
function addSaveToolBarButton() { $toolbar = JToolBar::getInstance('toolbar'); // Add a standard button //$bar->appendButton( 'Standard', $icon, $alt, $task, $listSelect, $x ); JLoader::register('JevModal', JPATH_LIBRARIES . "/jevents/jevmodal/jevmodal.php"); JevModal::modal("icalrepeat_dialogJQ"); $buttontext = JText::_('JEV_SAVE'); $buttonhtml = '<button onclick="javascript:return jQuery(\'#icalrepeat_dialogJQ\').modal(\'show\');" class="btn btn-small btn-success"> <span class="icon-apply" title="' . $buttontext . '"></span>' . $buttontext . '</button>'; $toolbar->appendButton('Custom', $buttonhtml, "apply"); $submitbutton = "Joomla.submitbutton"; // reuse action_dialog for sizing purposes ?> <div id="icalrepeat_dialogJQ" class="action_dialogJQ modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog modal-sm"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h4 class="modal-title" id="myModalLabel"><?php echo JText::_("JEV_SAVE"); ?> </h4> </div> <div class="modal-body"> <?php $buttontext = JText::_('JEV_SAVE_THIS'); $buttontask = "icalrepeat.save"; ?> <div class="icalrepeat-saveoptions" > <div style="margin-bottom:10px;"> <button onclick="javascript:<?php echo $submitbutton; ?> ('<?php echo $buttontask; ?> ');return false;" class="btn btn-small"> <span class="icon-save" style='margin:0px' title="<?php echo strip_tags($buttontext); ?> "></span> <?php echo $buttontext; ?> </button> </div> <?php /* $buttontext = JText::_( 'JEV_SAVE_FUTURE' ); $buttontask = "icalrepeat.savefuture"; <div><a href="#" onclick="javascript:return submitbutton('<?php echo $buttontask;?>')" class="toolbar"><span class="icon-32-save" style='margin:0px' title="<?php echo strip_tags($buttontext);?>"></span><?php echo $buttontext;?></a></div> */ ?> <?php $buttontext = JText::_('JEV_SAVE_ALL'); $buttontask = "icalevent.save"; ?> <div> <button onclick="javascript:<?php echo $submitbutton; ?> ('<?php echo $buttontask; ?> ');return false;" class="btn btn-small"> <span class="icon-save" style='margin:0px' title="<?php echo strip_tags($buttontext); ?> "> </span><?php echo $buttontext; ?> </button> </div> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal"><?php echo JText::_("JEV_CLOSE"); ?> </button> </div> </div> </div> </div> <?php }