Ejemplo n.º 1
0
 /**
  * This function builds the part of supporter logos.
  *
  * @access protected
  * @author kalmer
  * @param string                          $parameters['folder']       the
  * 		folder for the TPL-files
  * @param string                          $parameters['file']         the
  * 		TPL-file name without the ending
  * @param integer|string[string][integer] $parameters['logos']        the
  * 		logos, whereas the lowest-level-indexes are <code>hrefOLogo</code>,
  * 		<code>idInquiry</code> and <code>nimi</code>
  * @param string                          $parameters['block']        the
  * 		template block name
  * @param string                          $parameters['category']     the
  * 		supporter category
  * @param integer[string]                 $parameters['sizes']        the
  * 		<code>width</code> and <code>height</code> of the target logos
  * @param integer                         $parameters['minimalWidth'] If the
  * 		image is smaller than the given minimal width then our logo will be
  * 		shown instead.
  * @param integer $parameters['widthOfBlock']                         the
  * 		width of the block in pixels
  * @return string the parsed block of the logos
  * @uses DOMAIN for addressing
  * @uses O_FOLDER to access the manager for errors
  * @uses View     for managing errors
  */
 protected static function buildLogos($parameters)
 {
     require_once O_FOLDER . 'errors/ErrorView.php';
     \PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array(new ErroView(), 'raiseError'));
     require_once 'HTML/Template/IT.php';
     $tpl = new \HTML_Template_IT(dirname(__FILE__) . $folder);
     $tpl->loadTemplatefile($file . '.tpl');
     foreach ($logos as $idx => $logo) {
         require_once dirname(__FILE__) . '/../pildid/Pic.php';
         $firstImage = new Pic();
         $firstImage->getFirstImage('inquiry', $logo['idInquiry'], $sizes, isset($parameters['minimalWidth']) ? $parameters['minimalWidth'] : 200);
         $infoAboutFinalTargetInWeb = getimagesize($firstImage->src);
         $tpl->setCurrentBlock($block . '-supporter-logo');
         $tpl->setVariable(array($block . '-CAPTION-OF-LOGO' => $logo['nimi'], $block . '-CATEGORY-IN-LOGO' => $category['id'], $block . '-INDEX' => $idx, $block . '-LINK-OF-LOGO' => $logo['hrefOLogo'], $block . '-WIDTH-OF-LOGO' => $infoAboutFinalTargetInWeb[0], $block . '-HEIGHT-OF-LOGO' => $infoAboutFinalTargetInWeb[1], $block . '-SUPPORTER-LOGO' => $firstImage->src, $block . '-WIDTH-OF-BLOCK' => $parameters['widthOfBlock']));
         $tpl->parseCurrentBlock();
     }
     $tpl->setCurrentBlock($block . '-supporter-logos');
     $tpl->setVariable(array($block . '-CATEGORY' => $category['id'], $block . '-CATEGORY-TRANSLATION' => $category['translation']));
     $tpl->parseCurrentBlock();
     return $tpl->get($block . '-supporter-logos');
 }