Example #1
0
 protected function RenderButton($attrOverride)
 {
     if (!$this->blnInline) {
         $strHtml = parent::RenderButton($attrOverride);
         return \QHtml::RenderTag('div', ['class' => 'checkbox'], $strHtml);
     }
 }
Example #2
0
 protected function NavBar_Create()
 {
     $this->navBar = new Bs\Navbar($this, 'navbar');
     //$this->objMenu->AddCssClass('navbar-ryaa');
     $url = __PHP_ASSETS__ . '/_devtools/start_page.php';
     $this->navBar->HeaderText = QHtml::RenderTag("img", ["class" => "logo", "src" => __IMAGE_ASSETS__ . "/qcubed_logo_footer.png", "alt" => "Logo"], null, true);
     $this->navBar->HeaderAnchor = $url;
     $this->navBar->StyleClass = Bs\Bootstrap::NavbarInverse;
     $objList = new Bs\NavbarList($this->navBar);
     $objListMenu = new Bs\NavbarDropdown('List');
     $objEditMenu = new Bs\NavbarDropdown('New');
     // Add all the lists and edits in the drafts directory
     $list = scandir(__DOCROOT__ . __FORMS__);
     foreach ($list as $name) {
         if ($offset = strpos($name, '_list.php')) {
             $objListMenu->AddItem(new Bs\NavbarItem(substr($name, 0, $offset), null, __FORMS__ . '/' . $name));
         } elseif ($offset = strpos($name, '_edit.php')) {
             $objEditMenu->AddItem(new Bs\NavbarItem(substr($name, 0, $offset), null, __FORMS__ . '/' . $name));
         }
     }
     $objList->AddMenuItem($objListMenu);
     $objList->AddMenuItem($objEditMenu);
     /*
     
     $objRandomMenu = new Bs\NavbarDropdown('Contribute');
     
     $objList->AddMenuItem (new Bs\NavbarItem("Login", __SUBDIRECTORY__ . '/private/login.html', 'navbarLogin'));
     */
 }
Example #3
0
 /**
  * Returns the html for the control.
  * @return string
  * @throws \QCallerException
  */
 public function GetControlHtml()
 {
     $strHtml = \QHtml::RenderString($this->Name);
     if (!$this->blnAsButton) {
         $strHtml .= ' <span class="caret"></span>';
         $strHtml = $this->RenderTag("a", ["href" => "#", "data-toggle" => "dropdown", "aria-haspopup" => "true", "aria-expanded" => "false"], null, $strHtml);
     } else {
         if (!$this->blnSplit) {
             $strHtml .= ' <span class="caret"></span>';
             $strHtml = $this->RenderTag("button", ["data-toggle" => "dropdown", "aria-haspopup" => "true", "aria-expanded" => "false"], null, $strHtml);
         } else {
             $strHtml = $this->RenderTag("button", null, null, $strHtml);
             $strClass = "btn dropdown-toggle " . $this->strButtonSize . " " . $this->strButtonStyle;
             $strHtml .= \QHtml::RenderTag("button", ["class" => $strClass, "data-toggle" => "dropdown", "aria-haspopup" => "true", "aria-expanded" => "false"]);
         }
     }
     if ($this->HasDataBinder()) {
         $this->CallDataBinder();
     }
     if ($this->GetItemCount()) {
         $strListHtml = '';
         foreach ($this->GetAllItems() as $objItem) {
             $strListHtml .= $this->GetItemHtml($objItem);
         }
         $strHtml .= \QHtml::RenderTag("ul", ["id" => $this->ControlId . "_list", "class" => "dropdown-menu", "aria-labelledby" => $this->ControlId], $strListHtml);
     }
     if ($this->HasDataBinder()) {
         $this->RemoveAllItems();
     }
     return $strHtml;
 }
Example #4
0
 public function GetItemText()
 {
     $strHtml = \QApplication::HtmlEntities($this->strName);
     if ($strAnchor = $this->strAnchor) {
         $strHtml = \QHtml::RenderTag('a', ['href' => $strAnchor], $strHtml, false, true);
     }
     return $strHtml;
 }
Example #5
0
 /**
  * Used by drawing routines to render the attributes associated with this control.
  *
  * @param null $attributeOverrides
  * @param null $styleOverrides
  * @return string
  */
 public function RenderHtmlAttributes($attributeOverrides = null, $styleOverrides = null)
 {
     if ($this->intButtonMode == \QRadioButtonList::ButtonModeSet) {
         $attributeOverrides["data-toggle"] = "buttons";
         $attributeOverrides["class"] = $this->CssClass;
         \QHtml::AddClass($attributeOverrides["class"], "btn-group");
     }
     return parent::RenderHtmlAttributes($attributeOverrides, $styleOverrides);
 }
/**
 * Standard Print as Block function.  To aid with possible cross-scripting vulnerabilities,
 * this will automatically perform htmlspecialchars unless otherwise specified.
 *
 * Difference between _b() and _p() is that _b() will convert any linebreaks to <br/> tags.
 * This allows _b() to print any "block" of text that will have linebreaks in standard HTML.
 *
 * @param string $strString
 * @param boolean $blnHtmlEntities
 */
function _b($strString, $blnHtmlEntities = true)
{
    // Text Block Print
    if ($blnHtmlEntities && gettype($strString) != 'object') {
        print QHtml::RenderString($strString);
    } else {
        print nl2br($strString);
    }
}
 protected function helpTestRemoveClass($objTestDataArray)
 {
     $strOldValue = $objTestDataArray["OldValue"];
     $newValue = $objTestDataArray["NewValue"];
     $blnChanged = QHtml::RemoveClass($strOldValue, $newValue);
     $this->assertEquals($objTestDataArray["Changed"], $blnChanged);
     $this->assertEquals($objTestDataArray["Expected"], $strOldValue);
     // problem with sending a percent sign into message, so we just use default message.
 }
Example #8
0
 protected function GetIndicatorsHtml()
 {
     $strToReturn = '';
     for ($intIndex = 0; $intIndex < $this->GetItemCount(); $intIndex++) {
         if ($intIndex == 0) {
             $strToReturn .= \QHtml::RenderTag('li', ['data-target' => '#' . $this->strControlId, 'data-slide-to' => $intIndex, 'class' => "active"]);
         } else {
             $strToReturn .= \QHtml::RenderTag('li', ['data-target' => '#' . $this->strControlId, 'data-slide-to' => $intIndex]);
         }
     }
     return $strToReturn;
 }
 /**
  * Rendered the children of this control
  * @param bool $blnDisplayOutput Send the output to client?
  *
  * @return null|string
  */
 protected function RenderChildren($blnDisplayOutput = true)
 {
     $strToReturn = "";
     foreach ($this->GetChildControls() as $objControl) {
         if (!$objControl->Rendered) {
             $renderMethod = $objControl->strPreferredRenderMethod;
             $strToReturn .= QHtml::RenderTag('div', null, $objControl->{$renderMethod}(false));
         }
     }
     if ($blnDisplayOutput) {
         print $strToReturn;
         return null;
     } else {
         return $strToReturn;
     }
 }
 protected function GetControlHtml()
 {
     $attrOverrides['id'] = $this->strLinkUrl ? $this->strControlId . '_img' : $this->strControlId;
     // if a link, the parent tag will be the main tag
     $attrOverrides['src'] = $this->mixImageStandard instanceof QImageBase ? $this->mixImageStandard->RenderAsImgSrc(false) : $this->mixImageStandard;
     if (!$this->AltText) {
         $attrOverrides['alt'] = $this->ToolTip;
     }
     $strHtml = $this->RenderTag('img', $attrOverrides, null, null, true);
     if ($this->strLinkUrl) {
         $linkOverrides['href'] = $this->strLinkUrl;
         $linkOverrides['id'] = $this->strControlId;
         $linkOverrides['name'] = $this->strControlId;
         $this->GetLinkStyler()->ToolTip = $this->ToolTip;
         // copy tooltip
         $strLinkAttributes = $this->GetLinkStyler()->RenderHtmlAttributes($linkOverrides);
         $strHtml = QHtml::RenderTag('a', $strLinkAttributes, $strHtml);
     }
     return $strHtml;
 }
 /**
  * Renders an html tag with the given attributes and inner html.
  *
  * If the innerHtml is detected as being wrapped in an html tag of some sort, it will attempt to format the code so that
  * it has a structured view in a browser, with the inner html indented and on a new line in between the tags. You
  * can turn this off by setting __MINIMIZE__, or by passing in true to $blnNoSpace.
  *
  * There area a few special cases to consider:
  * - Void elements will not be formatted to avoid adding unnecessary white space since these are generally
  *   inline elements
  * - Non-void elements always use internal newlines, even in __MINIMIZE__ mode. This is to prevent different behavior
  *   from appearing in __MINIMIZE__ mode on inline elements, because inline elements with internal space will render with space to separate
  *   from surrounding elements. Usually, this is not an issue, but in the special situations where you really need inline
  *   elements to be right up against its siblings, set $blnNoSpace to true.
  *
  *
  * @param string 		$strTag				The tag name
  * @param null|mixed 	$mixAttributes 		String of attribute values or array of attribute values.
  * @param null|string 	$strInnerHtml 		The html to print between the opening and closing tags. This will NOT be escaped.
  * @param boolean		$blnIsVoidElement 	True to print as a tag with no closing tag.
  * @param boolean		$blnNoSpace		 	Renders with no white-space. Useful in special inline situations.
  * @return string						The rendered html tag
  */
 public static function RenderTag($strTag, $mixAttributes, $strInnerHtml = null, $blnIsVoidElement = false, $blnNoSpace = false)
 {
     assert('!empty($strTag)');
     $strToReturn = '<' . $strTag;
     if ($mixAttributes) {
         if (is_string($mixAttributes)) {
             $strToReturn .= ' ' . trim($mixAttributes);
         } else {
             // assume array
             $strToReturn .= QHtml::RenderHtmlAttributes($mixAttributes);
         }
     }
     if ($blnIsVoidElement) {
         $strToReturn .= ' />';
         // conforms to both XHTML and HTML5 for both normal and foreign elements
     } elseif ($blnNoSpace || substr(trim($strInnerHtml), 0, 1) !== '<') {
         $strToReturn .= '>' . $strInnerHtml . '</' . $strTag . '>';
     } else {
         // the hardcoded newlines below are important to prevent different drawing behavior in MINIMIZE mode
         $strToReturn .= '>' . "\n" . _indent(trim($strInnerHtml)) . "\n" . '</' . $strTag . '>' . _nl();
     }
     return $strToReturn;
 }
 /**
  * Returns the formatted value of type <length>.
  * See http://www.w3.org/TR/CSS1/#units for more info.
  * @param string $strValue The number or string to be formatted to the <length> compatible value.
  * @return string the formatted value of type <length>.
  * @deprecated use QHtml::formatLength
  */
 public static final function FormatLength($strValue)
 {
     return QHtml::FormatLength($strValue);
 }
    public function inputMultiImage($controller, $fieldKey, $fieldData)
    {
        $controller = $controller != '' ? $controller : 'item';
        $data = '';
        // 		bug($fieldData); return;
        if ($fieldData != '') {
            $images = json_decode($fieldData);
            //			$data = '';
            foreach ($images as $name) {
                $data .= '<div class="slide-item"><img height="48" alt="" src="' . $this->CI->config->item('resource_url') . "/{$controller}/{$name}" . '"><span class="name">' . $name . '</span><span class="remove"></span><input type="hidden" name="' . $fieldKey . '[]" value="' . $name . '" /></div>';
            }
        }
        // 		$input ="<button  id='$fieldKey-select-image' value='quanquan'>".QHtml::media('media_select.png',20,20)." Lựa Chọn Hình Ảnh</button><div id='$fieldKey-items' class='connectedSortable'>$data</div>";
        $input = "<button class='{$fieldKey}-select-image'  value='{$fieldKey}'>" . QHtml::media('media_select.png', 20, 20) . " Lựa Chọn Hình Ảnh</button><div id='{$fieldKey}-items' class='connectedSortable'>{$data}</div>";
        $input .= '<script type="text/javascript">';
        $input .= 'function slideItemEvents(){
		jQuery(".slide-item").hover(function(){jQuery("span.remove",this).css("display","block");},
		function(){jQuery("span.remove",this).css("display","none");});
		jQuery("span.remove").click(function(){jQuery(this).parents("div.slide-item").remove();});
		jQuery( "#slide-items" ).sortable({
		connectWith: ".connectedSortable",
		"items": "div..slide-item",
		"placeholder":"slide-item-holder slide-item"
	}).disableSelection();
	}';
        $input .= 'jQuery(".' . $fieldKey . '-select-image").click(function(){ ' . 'buttonVal=jQuery(this).attr("value");' . "\t\t\t\tvar fm = \$('<div/>').dialogelfinder({\n\t\turl : '" . base_url("resource/images_list?dir=" . $controller) . "',\n\t\tlang : 'en', width : 840,destroyOnClose : true,\n\t\tgetFileCallback : function(files, fm) {\n\t\t\t\n\t\t\timgURL = files.replace('" . $this->CI->config->item('resource_url') . "/" . $controller . "/','');\n\t\timageItem = '<div class=\"slide-item\"><img height=\"48\" alt=\"\" src=\"'+files+'\"><span class=\"name\">'+imgURL+'</span><span class=\"remove\"></span><input type=\"hidden\" name=\"'+buttonVal+'[]\" value=\"'+imgURL+'\" /></div>';\n\t\tjQuery('#{$fieldKey}-items').append(imageItem);\n\t\n\t\t" . "\t\t\t\t},commandsOptions : {getfile : { oncomplete : 'close',folders : false}}\n\t}).dialogelfinder('instance');" . 'return false;
	});';
        $input .= 'jQuery(document).ready(slideItemEvents);';
        $input .= '</script>';
        // 		$title = ($this->lang->line($fieldKey)!='')?$this->lang->line($fieldKey):$this->lang->line($controller.' '.$fieldKey);
        return self::rowForm($controller, $fieldKey, $input);
    }
Example #14
0
 protected function GetHelpBlock()
 {
     $strHtml = "";
     if ($this->strValidationError) {
         $strHtml .= \QHtml::RenderTag('p', ['class' => 'help-block', 'id' => $this->strControlId . '_error'], $this->strValidationError);
     } elseif ($this->strWarning) {
         $strHtml .= \QHtml::RenderTag('p', ['class' => 'help-block', 'id' => $this->strControlId . '_warning'], $this->strWarning);
     } elseif ($this->strInstructions) {
         $strHtml .= \QHtml::RenderTag('p', ['class' => 'help-block', 'id' => $this->strControlId . '_help'], $this->strInstructions);
     }
     return $strHtml;
 }
 public function chkSelectAll_Render($blnWithLabel = false)
 {
     $colIndex = $this->GetColIndex();
     $controlId = 'chkSelectAll' . $colIndex . $this->objDataGrid->ControlId;
     $this->chkSelectAll = $this->objDataGrid->GetChildControl($controlId);
     if (null === $this->chkSelectAll) {
         $this->chkSelectAll = new QCheckBox($this->objDataGrid, $controlId);
         $this->chkSelectAll->Name = QApplication::Translate('Select All');
         $colIndex = $this->GetColIndex();
         $strControlIdStart = 'chkSelect' . $colIndex . $this->objDataGrid->ControlId . 'n';
         $strControlIdStartLen = strlen($strControlIdStart);
         //Since a QDataGridLegacyColumn isn't a control, we can't include external js files, or have EndScripts
         //so we'll just have to include all the code in the onclick itself
         //hopefully this won't result in much duplication, since there shouldn't be too many
         //of these on a single form
         $strJavascript = "var datagrid = document.getElementById('{$this->objDataGrid->ControlId}');var selectAll = document.getElementById('{$this->chkSelectAll->ControlId}');var childInputs = datagrid.getElementsByTagName('input');for(var i = 0; i < childInputs.length; i++){var subid = childInputs[i].id.substring({$strControlIdStartLen}, 0);if(subid == '{$strControlIdStart}')childInputs[i].checked = selectAll.checked;}";
         $this->chkSelectAll->AddAction(new QClickEvent(), new QJavaScriptAction($strJavascript));
     }
     $strOutput = $this->chkSelectAll->Render(false);
     if ($blnWithLabel) {
         $strOutput = QHtml::RenderTag('label', null, $this->strName . ' ' . $strOutput);
     }
     return $strOutput;
 }
 /**
  * Render the button code. Broken out to allow QRadioButton to use it too.
  *
  * @param $attrOverride
  * @return string
  */
 protected function RenderButton($attrOverride)
 {
     if ($this->blnChecked) {
         $attrOverride['checked'] = 'checked';
     }
     if (strlen($this->strText)) {
         $strText = $this->blnHtmlEntities ? QApplication::HtmlEntities($this->strText) : $this->strText;
         if (!$this->blnWrapLabel) {
             $strLabelAttributes = ' for="' . $this->strControlId . '"';
         } else {
             $strLabelAttributes = $this->RenderLabelAttributes();
         }
         $strCheckHtml = QHtml::RenderLabeledInput($strText, $this->strTextAlign == QTextAlign::Left, $this->RenderHtmlAttributes($attrOverride), $strLabelAttributes, $this->blnWrapLabel);
         if (!$this->blnWrapLabel) {
             // Additionally wrap in a span so we can associate the label with the checkbox visually and apply the styles
             $strCheckHtml = QHtml::RenderTag('span', $this->RenderLabelAttributes(), $strCheckHtml);
         }
     } else {
         $strCheckHtml = $this->RenderTag('input', $attrOverride, null, null, true);
     }
     return $strCheckHtml;
 }
 /**
  * Format a comment block if we are not in MINIMIZE mode.
  *
  * @param string $strType	Either QControl::CommentStart or QControl::CommentEnd
  * @return string
  */
 public function RenderComment($strType)
 {
     return QHtml::Comment($strType . ' ' . get_class($this) . ' ' . $this->strName . ' id:' . $this->strControlId);
 }
 /**
  * Return the inner html for the select box.
  * @return string
  */
 protected function RenderInnerHtml()
 {
     $strHtml = '';
     $intItemCount = $this->GetItemCount();
     if (!$intItemCount) {
         return '';
     }
     $groups = array();
     for ($intIndex = 0; $intIndex < $intItemCount; $intIndex++) {
         $objItem = $this->GetItem($intIndex);
         // Figure Out Groups (if applicable)
         if ($strGroup = $objItem->ItemGroup) {
             $groups[$strGroup][] = $objItem;
         } else {
             $groups[''][] = $objItem;
         }
     }
     foreach ($groups as $strGroup => $items) {
         if (!$strGroup) {
             foreach ($items as $objItem) {
                 $strHtml .= $this->GetItemHtml($objItem);
             }
         } else {
             $strGroupHtml = '';
             foreach ($items as $objItem) {
                 $strGroupHtml .= $this->GetItemHtml($objItem);
             }
             $strHtml .= QHtml::RenderTag('optgroup', ['label' => QApplication::HtmlEntities($strGroup)], $strGroupHtml);
         }
     }
     return $strHtml;
 }
Example #19
0
 public function BindData()
 {
     $a = [QHtml::MakeUrl(QApplication::$ScriptName, null, 'anchor'), QHtml::MakeUrl(QApplication::$ScriptName, ['a' => 1, 'b' => 'this & that', 'c' => '/forward\\back']), QHtml::MakeUrl(QApplication::$ScriptName, ['a' => 1, 'b' => 'this & that', 'c' => '/forward\\back'], null, QHtml::HTTP, $_SERVER['HTTP_HOST']), QHtml::MailToUrl('test', 'qcu.be', ['subject' => 'Hey you.']), QHtml::MailToUrl('test', 'qcu.be', ['subject' => 'What & About \\ this /']), QHtml::MailToUrl('"very.(),:;<>[]\\".VERY.\\"very@\\ \\"very\\".unusual"', 'strange.email.com', ['subject' => 'What & About \\ this /'])];
     $this->dtg->DataSource = $a;
     $this->lblVars->Text = var_dump($_GET);
 }
 public static function PageLinks()
 {
     $strPrevious = null;
     $strNext = null;
     $blnFound = false;
     $strScript = QApplication::$ScriptName;
     if (strpos($strScript, "plugin") !== false && strpos($strScript, "vendor") !== false) {
         // a plugin
         $strLink = QHtml::RenderLink(QHtml::MakeUrl(__DEVTOOLS_ASSETS__ . '/plugin_manager.php'), "Plugin Manager", ["class" => "headerLink"]);
         return $strLink;
     }
     foreach (Examples::$Categories as $objExampleCategory) {
         if (!$blnFound) {
             $strPrevious = null;
             $strNext = null;
             foreach ($objExampleCategory as $strKey => $strExample) {
                 if (is_numeric($strKey)) {
                     // Pull out the URL fragment from the example tree
                     $intPosition = strpos($strExample, ' ');
                     $strScriptName = substr($strExample, 0, $intPosition);
                     $strDescription = substr($strExample, $intPosition + 1);
                     $qapp = QApplication::$ScriptName;
                     if (!$blnFound) {
                         if (strpos(QApplication::$ScriptName, $strScriptName) !== false || strpos($strScriptName, QApplication::$ScriptName) !== false) {
                             // for plugins examples
                             $blnFound = true;
                         } else {
                             $strPrevious = sprintf('<strong><a href="%s" class="headerLink">&lt;&lt; %s</a></strong>', $strScriptName, $strDescription);
                         }
                     } else {
                         if (!$strNext) {
                             $strNext = sprintf('<strong><a href="%s" class="headerLink">%s &gt;&gt;</a></strong>', $strScriptName, $strDescription);
                         }
                     }
                 }
             }
         }
     }
     $strToReturn = '';
     if ($strPrevious) {
         $strToReturn = $strPrevious;
     } else {
         $strToReturn = '<span class="headerGray">&lt;&lt; Previous</span>';
     }
     $intCategoryId = Examples::GetCategoryId();
     if ($intCategoryId < 3) {
         $intPartId = 1;
     } else {
         if ($intCategoryId < 10) {
             $intPartId = 2;
         } else {
             $intPartId = 3;
         }
     }
     $strToReturn .= ' &nbsp; | &nbsp; ';
     $strToReturn .= sprintf('<strong><a href="%s/index.php%s" class="headerLink">Back to Main</a></strong>', __VIRTUAL_DIRECTORY__ . __EXAMPLES__, $intPartId == 1 ? "" : "/" . $intPartId);
     $strToReturn .= ' &nbsp; | &nbsp; ';
     if ($strNext) {
         $strToReturn .= $strNext;
     } else {
         $strToReturn .= '<span class="headerGray">Next &gt;&gt;</span>';
     }
     return $strToReturn;
 }
Example #21
0
 /**
  * Renders the given html with an anchor wrapper that will make it toggle the currently drawn item. This should be called
  * from your drawing callback when drawing the heading. This could span the entire heading, or just a portion.
  *
  * @param $strHtml
  */
 public function RenderToggleHelper($strHtml, $blnRenderOutput = true)
 {
     if ($this->intCurrentItemIndex == $this->intCurrentOpenItem) {
         $strClass = '';
         $strExpanded = 'true';
     } else {
         $strClass = 'collapsed';
         $strExpanded = 'false';
     }
     $strCollapseId = $this->strControlId . '_collapse_' . $this->intCurrentItemIndex;
     $strOut = \QHtml::RenderTag('a', ['class' => $strClass, 'data-toggle' => 'collapse', 'data-parent' => '#' . $this->strControlId, 'href' => '#' . $strCollapseId, 'aria-expanded' => $strExpanded, 'aria-controls' => $strCollapseId], $strHtml, false, true);
     if ($blnRenderOutput) {
         echo $strOut;
     } else {
         return $strOut;
     }
 }
 /**
  * Render as a single column. This implementation simply wraps the rows in divs.
  * @return string
  */
 public function RenderButtonColumn()
 {
     $count = $this->ItemCount;
     $strToReturn = '';
     $groupAttributes = null;
     if ($this->strButtonGroupClass) {
         $groupAttributes = ["class" => $this->strButtonGroupClass];
     }
     for ($intIndex = 0; $intIndex < $count; $intIndex++) {
         $strHtml = $this->GetItemHtml($this->GetItem($intIndex), $intIndex, $this->GetHtmlAttribute('tabindex'), $this->blnWrapLabel);
         $strToReturn .= QHtml::RenderTag('div', $groupAttributes, $strHtml);
     }
     return $this->RenderTag('div', null, null, $strToReturn);
 }
 /**
  * Render as a single column. This implementation simply wraps the columns in divs.
  * @return string
  */
 public function RenderButtonColumn()
 {
     $count = $this->ItemCount;
     $strToReturn = '';
     for ($intIndex = 0; $intIndex < $count; $intIndex++) {
         $strHtml = $this->GetItemHtml($this->objListItemArray[$intIndex], $intIndex, $this->GetHtmlAttribute('tabindex'), $this->blnWrapLabel);
         $strToReturn .= QHtml::RenderTag('div', null, $strHtml);
     }
     $strToReturn = $this->RenderTag('div', ['id' => $this->strControlId], null, $strToReturn);
     return $strToReturn;
 }
 /**
  * Return the text html of the item.
  *
  * @param mixed $objItem
  * @return string
  */
 protected function GetItemText($objItem)
 {
     $strHtml = QApplication::HtmlEntities($objItem->Text);
     if ($strAnchor = $objItem->Anchor) {
         $strHtml = QHtml::RenderTag('a', ['href' => $strAnchor], $strHtml, false, true);
     }
     return $strHtml;
 }
 /**
  * Return the html for the table.
  *
  * @return string
  */
 protected function GetControlHtml()
 {
     $this->DataBind();
     if (empty($this->objDataSource) && $this->blnHideIfEmpty) {
         $this->objDataSource = null;
         return '';
     }
     $strHtml = $this->RenderCaption();
     // Column tags (if applicable)
     if ($this->blnRenderColumnTags) {
         $strHtml .= $this->GetColumnTagsHtml();
     }
     // Header Row (if applicable)
     if ($this->blnShowHeader) {
         $strHtml .= QHtml::RenderTag('thead', null, $this->GetHeaderRowHtml());
     }
     // Footer Row (if applicable)
     if ($this->blnShowFooter) {
         $strHtml .= QHtml::RenderTag('tfoot', null, $this->GetFooterRowHtml());
     }
     // DataGrid Rows
     $strRows = '';
     $this->intCurrentRowIndex = 0;
     if ($this->objDataSource) {
         foreach ($this->objDataSource as $objObject) {
             $strRows .= $this->GetDataGridRowHtml($objObject, $this->intCurrentRowIndex);
             $this->intCurrentRowIndex++;
         }
     }
     $strHtml .= QHtml::RenderTag('tbody', null, $strRows);
     $strHtml = $this->RenderTag('table', null, null, $strHtml);
     $this->objDataSource = null;
     return $strHtml;
 }
 /**
  * Override to return sortable column info.
  *
  * @param $objColumn
  * @return string
  */
 protected function GetHeaderCellContent($objColumn)
 {
     $blnSortable = false;
     $strCellValue = $objColumn->FetchHeaderCellValue();
     if ($objColumn->HtmlEntities) {
         $strCellValue = QApplication::HtmlEntities($strCellValue);
     }
     $strCellValue = QHtml::RenderTag('span', null, $strCellValue);
     // wrap in a span for positioning
     if ($this->strSortColumnId === $objColumn->Id) {
         if ($this->intSortDirection == self::SortAscending) {
             $strCellValue = $strCellValue . ' ' . QHtml::RenderTag('i', ['class' => 'fa fa-sort-desc fa-lg']);
         } else {
             $strCellValue = $strCellValue . ' ' . QHtml::RenderTag('i', ['class' => 'fa fa-sort-asc fa-lg']);
         }
         $blnSortable = true;
     } else {
         if ($objColumn->OrderByClause) {
             // sortable, but not currently being sorted
             $strCellValue = $strCellValue . ' ' . QHtml::RenderTag('i', ['class' => 'fa fa-sort fa-lg', 'style' => 'opacity:0.8']);
             $blnSortable = true;
         }
     }
     if ($blnSortable) {
         // Wrap header cell in an html5 block-link to help with assistive technologies.
         $strCellValue = QHtml::RenderTag('div', null, $strCellValue);
         $strCellValue = QHtml::RenderTag('a', ['href' => 'javascript:;'], $strCellValue);
         // action will be handled by qcubed.js click handler in qcubed.datagrid2()
     }
     return $strCellValue;
 }
 /**
  * Returns the html corresponding to a given item. You have many ways of rendering an item:
  * 	- Specify a template that will get evaluated for each item. See EvaluateTemplate for more info.
  *  - Specify a HtmlCallback callable to be called for each item to get the html for the item.
  *  - Override this routine.
  *  - Specify the item's tag name, and then use the helper functions or callbacks to return just the
  *    attributes and/or inner html of the object.
  *
  * @param $objItem
  * @return string
  * @throws QCallerException
  */
 protected function GetItemHtml($objItem)
 {
     if ($this->strTemplate) {
         return $this->EvaluateTemplate($this->strTemplate);
     } elseif ($this->itemHtmlCallback) {
         if (is_string($this->itemHtmlCallback)) {
             $strMethod = $this->itemHtmlCallback;
             return $this->objForm->{$strMethod}($objItem, $this->intCurrentItemIndex);
         } else {
             return call_user_func($this->itemHtmlCallback, $objItem, $this->intCurrentItemIndex);
         }
     }
     if (!$this->strItemTagName) {
         throw new QCallerException("You must specify an item tag name before rendering the list.");
     }
     $strToReturn = QHtml::RenderTag($this->strItemTagName, $this->GetItemAttributes($objItem), $this->GetItemInnerHtml($objItem));
     return $strToReturn;
 }
 /**
  * Returns the HTML for the tab header. This includes the names and the control logic to record what the
  * user clicked.
  *
  * @return string
  */
 protected function GetTabHeaderHtml()
 {
     $strHtml = '';
     $childControls = $this->GetChildControls();
     for ($i = 0, $cnt = count($childControls); $i < $cnt; ++$i) {
         $strControlId = $childControls[$i]->ControlId;
         if (array_key_exists($key = $strControlId, $this->objTabHeadersArray) || array_key_exists($key = $i, $this->objTabHeadersArray)) {
             $objHeader = $this->objTabHeadersArray[$key];
             if ($objHeader instanceof QControl) {
                 $strText = $objHeader->GetControlHtml();
             } else {
                 $strText = (string) $objHeader;
             }
         } elseif ($strName = $childControls[$i]->Name) {
             $strText = $strName;
         } else {
             $strText = 'Tab ' . ($i + 1);
         }
         $strAnchor = QHtml::RenderTag('a', ['href' => '#' . $strControlId], $strText, false, true);
         $strHtml .= QHtml::RenderTag('li', null, $strAnchor);
     }
     return QHtml::RenderTag('ul', null, $strHtml);
 }
 /**
  * Render just attributes that can be included in any html tag to attach the proxy to the tag.
  *
  * @param string|null $strActionParameter
  * @return string
  */
 public function RenderAttributes($strActionParameter = null)
 {
     $attributes['data-qpxy'] = $this->ControlId;
     if ($strActionParameter) {
         $attributes['data-qap'] = $strActionParameter;
     }
     return QHtml::RenderHtmlAttributes($attributes);
 }
 /**
  * Returns the final string representing the content of the cell.
  *
  * @param mixed $item
  * @return string
  */
 public function FetchCellValue($item)
 {
     $strText = parent::FetchCellValue($item);
     // allow post processing of cell label
     $getVars = null;
     if ($this->getVars) {
         if (is_array($this->getVars)) {
             if (array_keys($this->getVars)[0] === 0) {
                 // assume this is not associative array. Likely we are here to extract a property list.
                 $getVars = static::GetObjectValue($this->getVars, $item);
             } else {
                 // associative array, so likely these are Get variables to be assigned individually
                 foreach ($this->getVars as $key => $val) {
                     $getVars[$key] = static::GetObjectValue($val, $item);
                 }
             }
         } elseif ($this->getVars instanceof QQNode) {
             $getVars = static::GetObjectValue($this->getVars, $item);
         } else {
             $getVars = $this->getVars;
             // could be a simple action parameter.
         }
     }
     $tagAttributes = [];
     if ($this->tagAttributes && is_array($this->tagAttributes)) {
         foreach ($this->tagAttributes as $key => $val) {
             $tagAttributes[$key] = static::GetObjectValue($val, $item);
         }
     }
     if ($this->mixDestination === null) {
         return QApplication::HtmlEntities($strText);
     } elseif ($this->mixDestination instanceof QControlProxy) {
         if ($this->blnAsButton) {
             return $this->mixDestination->RenderAsButton($strText, $getVars, $tagAttributes);
         } else {
             return $this->mixDestination->RenderAsLink($strText, $getVars, $tagAttributes);
         }
     } else {
         $strDestination = static::GetObjectValue($this->mixDestination, $item);
         return QHtml::RenderLink(QHtml::MakeUrl($strDestination, $getVars), $strText, $tagAttributes);
     }
 }