コード例 #1
0
ファイル: shpopupbutton.php プロジェクト: sangkasi/joomla
 function fetchButton($type = 'Popup', $name = '', $text = '', $url = '', $popupOptions = array())
 {
     // merge with default options
     $defaultOptions = array('class' => 'modal', 'size' => array('x' => 640, 'y' => 500));
     $options = array_merge($defaultOptions, $popupOptions);
     $text = JText::_($text);
     $class = $this->fetchIconClass($name);
     $doTask = $this->_getCommand($name, $url);
     $modalOptionsString = Sh404sefHelperHtml::makeSqueezeboxOptions($options);
     $rel = ' {handler: \'iframe\'' . (empty($modalOptionsString) ? '' : ', ' . $modalOptionsString) . '}';
     $html = "<a class=\"{$options['class']}\" href=\"{$doTask}\" rel=\"{$rel}\">\n";
     $html .= "<span class=\"{$class}\" title=\"{$text}\">\n";
     $html .= "</span>\n";
     $html .= "{$text}\n";
     $html .= "</a>\n";
     return $html;
 }
コード例 #2
0
ファイル: html.php プロジェクト: lautarodragan/ideary
 /**
  * Builds up an html link using the various parts supplied
  *
  * @param $view a JView object, to be able to escape output text
  * @param $linkData an array of key/value pairs to build up the target links
  * @param $elementData an array holding element data : title, class, rel
  * @param $modal boolean, if true, required stuff to make the link open in modal box is added
  * @param $hasTip boolean, if true, required stuff to turn elementData['title'] into a tooltip is added
  * @param $extra an array holding key/value pairs, will be added as raw attributes to the link
  */
 public static function makeLink($view, $linkData, $elementData, $modal = false, $modalOptions = array(), $hasTip = false, $extra = array())
 {
     // calculate target link
     if ($modal) {
         $linkData['tmpl'] = 'component';
     }
     $url = Sh404sefHelperGeneral::buildUrl($linkData);
     $url = JRoute::_($url);
     // calculate title
     $title = empty($elementData['title']) ? '' : $elementData['title'];
     $title = is_null($view) ? $title : $view->escape($title);
     $attribs = array();
     // calculate class
     $class = empty($elementData['class']) ? '' : $elementData['class'];
     if ($hasTip) {
         $class .= ' ' . $hasTip;
     }
     // store title in attributes array
     if (!empty($title)) {
         $attribs['title'] = $title;
     }
     // store in attributes array
     if (!empty($class)) {
         $attribs['class'] = $class;
     }
     // calculate modal information
     $rel = empty($elementData['rel']) || is_null($view) ? '' : $view->escape($elementData['rel']);
     if ($modal) {
         $modalOptionsString = Sh404sefHelperHtml::makeSqueezeboxOptions($modalOptions);
         $rel .= ' {handler: \'iframe\'' . (empty($modalOptionsString) ? '' : ', ' . $modalOptionsString) . '}';
     }
     // store in attributes array
     if (!empty($rel)) {
         $attribs['rel'] = $rel;
     }
     // any custom attibutes ?
     if (!empty($extra)) {
         foreach ($extra as $key => $value) {
             $attribs[$key] = $value;
         }
     }
     // finish link
     $anchor = empty($elementData['anchor']) ? $title : $elementData['anchor'];
     return JHTML::link($url, $anchor, $attribs);
 }