/**
 * Smarty function to display a single inline user link of a specific policy for the Legal module.
 *
 * Example
 * {legalinlinelink policytype='termsofuse'}
 *
 * Tag Parameters:
 *      policyType  The unique string identifier of the policy typw whose inline link is to be returned; required.
 *      target      The target for the generated link, such as "_blank" to open the policy in a new window; optional, default is blank (same effect as "_self").
 *      assign      The name of the template variable to which the output is assiged, if provided; optional, if not specified the output is sent to the template.
 *
 * Templates used:
 *      legal_function_legalinlinelink_notfound.tpl
 *      legal_function_legalinlinelink_legalnotice.tpl
 *      legal_function_legalinlinelink_termsofuse.tpl
 *      legal_function_legalinlinelink_privacypolicy.tpl
 *      legal_function_legalinlinelink_tradeconditions.tpl
 *      legal_function_legalinlinelink_cancellationrightpolicy.tpl
 *      legal_function_legalinlinelink_accessibilitystatement.tpl
 *
 * Template Parameters Exported:
 *      $target  The target for the generated link, such as "_blank" to open the policy in a new window; optional, default is blank (same effect as "_self").
 *      (assign) If an assign tag parameter is specified, then a template variable a name equal to the value of the assign parameter is exported, containing the rendered output; optional, default is to return the output to the template.
 *
 * @param array       $params All parameters passed to this function from the template.
 * @param Zikula_View &$view  Reference to the Zikula view object, a subclass of Smarty.
 *
 * @return string The rendered template output for the specified policy type.
 */
function smarty_function_legalinlinelink($params, Zikula_View &$view)
{
    if (!isset($params['policyType'])) {
        $template = 'plugins/legal_function_legalinlinelink_notfound.tpl';
    } else {
        $params['policyType'] = strtolower($params['policyType']);
        $template = 'plugins/legal_function_legalinlinelink_' . $params['policyType'] . '.tpl';

        if (!$view->template_exists($template)) {
            $template = 'plugins/legal_function_legalinlinelink_notfound.tpl';
        }
    }

    $templateVars = array(
        'target' => isset($params['target']) ? $params['target'] : ''
    );

    $view->assign($templateVars);

    if (isset($params['assign']) && !empty($params['assign'])) {
        $view->assign($params['assign'], $view->fetch($template));
    } else {
        return $view->fetch($template);
    }
}
 /**
  * @param array $args
  *
  * @deprecated Use "getAuthenticationMethodSelectorAction" instead.
  *
  * @return string
  *
  * @throws \InvalidArgumentException
  * @throws FatalErrorException
  */
 public function getAuthenticationMethodSelector(array $args)
 {
     // Parameter extraction and error checking
     if (!isset($args) || !is_array($args)) {
         throw new \InvalidArgumentException($this->__('An invalid \'$args\' parameter was received.'));
     }
     if (!isset($args['form_type']) || !is_string($args['form_type'])) {
         throw new \InvalidArgumentException($this->__f('An invalid form type (\'%1$s\') was received.', array(isset($args['form_type']) ? $args['form_type'] : 'NULL')));
     }
     if (!isset($args['form_action']) || !is_string($args['form_action'])) {
         throw new \InvalidArgumentException($this->__f('An invalid form action (\'%1$s\') was received.', array(isset($args['form_action']) ? $args['form_action'] : 'NULL')));
     }
     if (!isset($args['method']) || !is_string($args['method']) || !$this->supportsAuthenticationMethod($args['method'])) {
         throw new \InvalidArgumentException($this->__f('Error: An invalid method (\'%1$s\') was received.', array(isset($args['method']) ? $args['method'] : 'NULL')));
     }
     // End parameter extraction and error checking
     if ($this->authenticationMethodIsEnabled($args['method'])) {
         /** @var \Zikula\UsersModule\Helper\AuthenticationMethodHelper $authenticationMethod */
         $authenticationMethod = $this->getAuthenticationMethod($args['method']);
         $icon = $authenticationMethod->getIcon();
         $isFontAwesomeIcon = $authenticationMethod->isFontAwesomeIcon();
         $templateVars = array('authentication_method' => array('modname' => $this->name, 'method' => $args['method']), 'is_selected' => isset($args['is_selected']) && $args['is_selected'], 'form_type' => $args['form_type'], 'form_action' => $args['form_action'], 'submit_text' => $authenticationMethod->getShortDescription(), 'icon' => $icon, 'isFontAwesomeIcon' => $isFontAwesomeIcon, 'skipLoginFormFieldsPage' => $authenticationMethod->getSkipLoginFormFieldsPage() && $args['form_type'] === 'registration');
         $view = new Zikula_View($this->serviceManager, 'ZikulaUsersModule', Zikula_View::CACHE_ENABLED);
         $view->assign($templateVars);
         $templateName = "Authentication/AuthenticationMethodSelector/{$args['form_type']}/Base.tpl";
         if (!$view->template_exists($templateName)) {
             $templateName = "Authentication/AuthenticationMethodSelector/Base/Base.tpl";
             if (!$view->template_exists($templateName)) {
                 throw new FatalErrorException($this->__f('A form fields template was not found for the %1$s method using form type \'%2$s\'.', array($args['method'], $args['form_type'])));
             }
         }
         return $this->response($view->fetch($templateName));
     } else {
         return $this->response('');
     }
 }
Example #3
0
 /**
  * Processes a template file using dompdf (LGPL).
  *
  * @param Zikula_View $view     Reference to view object.
  * @param string      $template Name of template to use.
  *
  * @return mixed Output.
  */
 protected function processPdf(Zikula_View $view, $template)
 {
     // first the content, to set page vars
     $output = $view->fetch($template);
     // make local images absolute
     $output = str_replace('img src="/', 'img src="' . System::serverGetVar('DOCUMENT_ROOT') . '/', $output);
     // see http://codeigniter.com/forums/viewthread/69388/P15/#561214
     //$output = utf8_decode($output);
     // then the surrounding
     $output = $view->fetch('include_pdfheader.tpl') . $output . '</body></html>';
     $controllerHelper = new MUVideo_Util_Controller($this->serviceManager);
     // create name of the pdf output file
     $fileTitle = $controllerHelper->formatPermalink(System::getVar('sitename')) . '-' . $controllerHelper->formatPermalink(PageUtil::getVar('title')) . '-' . date('Ymd') . '.pdf';
     // if ($_GET['dbg'] == 1) die($output);
     // instantiate pdf object
     $pdf = new \DOMPDF();
     // define page properties
     $pdf->set_paper('A4');
     // load html input data
     $pdf->load_html($output);
     // create the actual pdf file
     $pdf->render();
     // stream output to browser
     $pdf->stream($fileTitle);
     // prevent additional output by shutting down the system
     System::shutDown();
     return true;
 }
Example #4
0
 /**
  * Render the hook's output.
  *
  * @return string
  */
 public function __toString()
 {
     return $this->view->fetch($this->template);
 }
Example #5
0
 /**
  * Render template.
  *
  * @param Zikula_View $render       Renderer.
  * @param string      $objectType   Object type.
  * @param string      $type         Controller.
  * @param string      $func         Function of Controller.
  * @param string      $theme        Theme to use (themes are subfolders in /templates).
  * @param string      $tpl          Sub template name.
  * @param string      $defaultTheme Default theme (Use if $theme is null).
  *
  * @return string Rendered Template (HTML)
  */
 private function _renderTemplate(Zikula_View $render, $objectType, $type, $func, $theme = null, $tpl = null, $defaultTheme = null)
 {
     $template = $type . '_' . $func . '_' . $objectType;
     if ($tpl != null) {
         $template .= '_' . $tpl;
     }
     $template .= '.tpl';
     if (!empty($theme) && $render->template_exists(DataUtil::formatForOS($theme) . '/' . $template)) {
         $template = DataUtil::formatForOS($theme) . '/' . $template;
     } else {
         if (!empty($defaultTheme) && $render->template_exists(DataUtil::formatForOS($defaultTheme) . '/' . $template)) {
             $template = DataUtil::formatForOS($defaultTheme) . '/' . $template;
         }
     }
     return $render->fetch($template);
 }
Example #6
0
 /**
  * Processes a template file using dompdf (LGPL).
  *
  * @param Zikula_View $view     Reference to view object.
  * @param string      $template Name of template to use.
  *
  * @return mixed Output.
  */
 protected static function processPdf(Zikula_View $view, $template)
 {
     // first the content, to set page vars
     $output = $view->fetch($template);
     // see http://codeigniter.com/forums/viewthread/69388/P15/#561214
     //$output = utf8_decode($output);
     // then the surrounding
     $output = $view->fetch('include_pdfheader.tpl') . $output . '</body></html>';
     // create name of the pdf output file
     $fileTitle = MUBoard_Util_Controller::formatPermalink(System::getVar('sitename')) . '-' . MUBoard_Util_Controller::formatPermalink(PageUtil::getVar('title')) . '-' . date('Ymd') . '.pdf';
     //if ($_GET['dbg'] == 1) die($output);
     // instantiate pdf object
     $pdf = new DOMPDF();
     // define page properties
     $pdf->set_paper('A4');
     // load html input data
     $pdf->load_html($output);
     // create the actual pdf file
     $pdf->render();
     // stream output to browser
     $pdf->stream($fileTitle);
     // prevent additional output by shutting down the system
     System::shutDown();
     return true;
 }
Example #7
0
 /**
  *
  * this function provides a module own search api
  */
 public function moduleSearch($args)
 {
     $dom = ZLanguage::getModuleDomain('MUBoard');
     //$searchstring = $args['searchstring'];
     $searchstring = '%' . $args['searchstring'] . '%';
     $searchoptions = $args['searchoptions'];
     $searchplace = $args['searchplace'];
     $resultorder = $args['resultorder'];
     $kind = $args['kind'];
     $serviceManager = ServiceUtil::getManager();
     $view = new Zikula_View($serviceManager);
     $args['ot'] = 'posting';
     if ($kind == 'none') {
         $args['where'] = 'tbl.title LIKE \'' . DataUtil::formatForStore($searchstring) . '\'';
         if ($searchplace == 'content') {
             $args['where'] .= ' OR ';
             $args['where'] .= 'tbl.text LIKE \'' . DataUtil::formatForStore($searchstring) . '\'';
         }
         $args['orderBy'] = 'title ' . $resultorder;
     } else {
         if ($kind == 'latestPostings') {
             $time = ModUtil::getVar('MUBoard', 'latestPostings');
             $args['where'] = 'tbl.createdDate > DATE_SUB(';
             $args['where'] .= 'CURRENT_TIMESTAMP()';
             $args['where'] .= ',';
             $args['where'] .= $time;
             $args['where'] .= ', \'day\')';
         }
     }
     $entities = ModUtil::apiFunc($this->name, 'selection', 'getEntities', $args);
     if ($entities == false) {
         $message = __('Sorry! There is no entity for your search string. Please try another string!', $dom);
     } else {
         $message = '';
     }
     $resultedEntities = array();
     foreach ($entities as $entity) {
         if ($entity['parent_id'] != NULL) {
             $args['id'] = $entity['parent_id'];
             $args['useJoins'] = false;
             $parentEntity = ModUtil::apiFunc($this->name, 'selection', 'getEntity', $args);
             if (!in_array($parentEntity, $resultedEntities)) {
                 $resultedEntities[] = $parentEntity;
             }
         }
         if ($entity['parent_id'] == NULL) {
             if (!in_array($entity, $resultedEntities)) {
                 $resultedEntities[] = $entity;
             }
         }
     }
     $countResultedEntities = count($resultedEntities);
     if ($countResultedEntities > 0) {
         LogUtil::registerStatus(__('Congratulations! Your search has a result! We found ', $dom) . count($resultedEntities) . ' ' . _n('issue', 'issues', $countResultedEntities, $dom) . '!');
     }
     $view->assign('entities', $resultedEntities)->assign('message', $message);
     return $view->fetch('search/moduleResult.tpl');
 }