/** * Appends the non-inline attachment UI to the passed $text * * @param string Text to append attachments * @param array Attachment data * @param bool Whether to show images * @param array Array of nodeid => (nodeid, filedataid) attachments that should not be included in the attachment box. */ public function append_noninline_attachments($text, $attachments, $do_imgcode = false, $skiptheseattachments = array()) { foreach ($skiptheseattachments as $nodeid => $arr) { unset($attachments[$nodeid]); } if (!empty($attachments)) { foreach ($attachments as &$attachment) { $attachment['filesize'] = !empty($attachment['filesize']) ? vb_number_format($attachment['filesize'], 1, true) : 0; } $attach_url = vB5_Template_Options::instance()->get('options.frontendurl') . "/filedata/fetch?id="; if ($this->renderImmediate) { $text .= vB5_Template::staticRender('bbcode_attachment_list', array('attachments' => $attachments, 'attachurl' => $attach_url), false); } else { $text .= vB5_Template_Runtime::includeTemplate('bbcode_attachment_list', array('attachments' => $attachments, 'attachurl' => $attach_url)); } } return $text; }
public function actionFetchHiddenModules() { $api = Api_InterfaceAbstract::instance(); $result = array(); if (isset($_POST['modules']) and !empty($_POST['modules'])) { $widgets = $api->callApi('widget', 'fetchWidgetInstanceTemplates', array($_POST['modules'])); if ($widgets) { // register the templates, so we use bulk fetch $templateCache = vB5_Template_Cache::instance(); foreach ($widgets as $widget) { $templateCache->register($widget['template'], array()); } // now render them foreach ($widgets as $widget) { $result[] = array('widgetinstanceid' => $widget['widgetinstanceid'], 'template' => vB5_Template::staticRender($widget['template'], array('widgetid' => $widget['widgetid'], 'widgetinstanceid' => $widget['widgetinstanceid'], 'isWidget' => 1, 'title' => $widget['title']))); } } } return $result; }
/** * This method is used from template code to render a template and store it in a variable * @param string $templateName * @param array $data * @param bool $isParentTemplate */ public static function renderTemplate($templateName, $data = array(), $isParentTemplate = true) { if (empty($templateName)) { return null; } return vB5_Template::staticRender($templateName, $data, $isParentTemplate); }