/**
  * Returns block item XHTML 
  * 
  * @param mixed $args
  * @return array
  */
 public static function getValidItems($args)
 {
     include_once 'kernel/common/template.php';
     $http = eZHTTPTool::instance();
     $tpl = templateInit();
     $result = array();
     $blockID = $http->postVariable('block_id');
     $offset = $http->postVariable('offset');
     $limit = $http->postVariable('limit');
     $validNodes = eZFlowPool::validNodes($blockID);
     $counter = 0;
     foreach ($validNodes as $validNode) {
         $counter++;
         if ($counter <= $offset) {
             continue;
         }
         $tpl->setVariable('node', $validNode);
         $tpl->setVariable('view', 'block_item');
         $tpl->setVariable('image_class', 'blockgallery1');
         $content = $tpl->fetch('design:node/view/view.tpl');
         $result[] = $content;
         if ($counter === $limit) {
             break;
         }
     }
     return $result;
 }
コード例 #2
0
 /**
  * Abstract method to initialize a template and eventually takes advantage of new 4.3 TPL API
  * @return eZTemplate
  */
 public static function templateInit()
 {
     $tpl = null;
     if (eZPublishSDK::majorVersion() >= 4 && eZPublishSDK::minorVersion() < 3) {
         include_once 'kernel/common/template.php';
         $tpl = templateInit();
     } else {
         $tpl = eZTemplate::factory();
     }
     return $tpl;
 }
コード例 #3
0
ファイル: ezdebugoperators.php プロジェクト: gggeek/ezdebug
 /**
  Executes the needed operator(s).
  Checks operator names, and calls the appropriate functions.
 */
 function modify($tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$operatorValue, $namedParameters)
 {
     switch ($operatorName) {
         case 'eZDebug':
             $operatorValue = $this->eZdebug($operatorValue, $namedParameters['debuglvl'], $namedParameters['label']);
             break;
         case 'objDebug':
             $operatorValue = $this->objdebug($operatorValue, $namedParameters['show_values'] == 'show', $namedParameters['level']);
             break;
         case 'objInspect':
             require_once 'kernel/common/template.php';
             $tpl = templateInit();
             $tpl->setVariable('counter', self::$inspectcounter);
             $exts = eZExtension::activeExtensions();
             $wstransport = '';
             if (in_array('ezjscore', $exts)) {
                 $wstransport = 'ezjscore';
             } else {
                 if (in_array('ggwebservices', $exts)) {
                     $wstransport = 'ggwebservices';
                 }
             }
             $tpl->setVariable('transport', $wstransport);
             if (class_exists('ezPOInspector')) {
                 $tpl->setVariable('value', json_encode(ezPOInspector::objInspect($operatorValue)));
                 $tpl->setVariable('error', false);
             } else {
                 $tpl->setVariable('value', null);
                 $tpl->setVariable('error', "Cannot inspect value: extension ezpersistentobject_inspector most likely missing");
             }
             $tpl->setVariable('sort_attributes', $namedParameters['sort_attributes']);
             $tpl->setVariable('send_to_debug', $namedParameters['send_to_debug']);
             $operatorValue = $tpl->fetch('design:ezdebug/objinspect.tpl');
             if ($namedParameters['send_to_debug']) {
                 // send div to debug output via a debug msg
                 $tpl = templateInit();
                 $tpl->setVariable('counter', self::$inspectcounter);
                 eZDebug::writeDebug($tpl->fetch('design:ezdebug/objinspectdebugoutput.tpl'), 'objInspect ' . self::$inspectcounter);
             }
             self::$inspectcounter++;
             break;
         case 'addTimingPoint':
             eZDebug::addTimingPoint($namedParameters['label']);
             $operatorValue = '';
             break;
         case 'numQueries':
             $operatorValue = $this->numqueries($namedParameters['cluster']);
             break;
         case 'getDefinedVars':
             $operatorValue = $this->getDefinedVars($tpl, $namedParameters['namespace'], $rootNamespace, $currentNamespace);
             break;
     }
 }
コード例 #4
0
 function genereate($nodeID = 2)
 {
     $tpl = templateInit();
     $tpl->setVariable("start_node_id", $nodeID);
     $tpl->setVariable("sitemap_siteurl", $this->siteIni->variable('SiteSettings', 'SiteURL') . '/');
     $data = $tpl->fetch("design:googlesitemap/generate.tpl");
     $dataToFile = '<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.google.com/schemas/sitemap/0.9">' . $data . '</urlset>';
     $file = $this->ini->variable('PathSettings', 'StaticSitemapFile');
     if (!($handle = fopen($file, 'w+'))) {
         echo 'Error: Could not open file ' . $file . ' for writing.' . PHP_EOL;
         return false;
         exit;
     }
     // Write $somecontent to our opened file.
     if (fwrite($handle, $dataToFile) === FALSE) {
         echo 'error';
     }
     echo "\t file created: " . $file . PHP_EOL;
     fclose($handle);
     $this->ping($file);
 }
コード例 #5
0
//  READ THE eZ BUL BEFORE USING, INSTALLING OR MODIFYING THE SOFTWARE.

// ## END COPYRIGHT, LICENSE AND WARRANTY NOTICE ##
//

/**
 * File containing the elevate view of the ezfind module.
 *
 * @package eZFind
 */

require_once( "kernel/common/template.php" );

$module = $Params['Module'];
$http = eZHTTPTool::instance();
$tpl = templateInit();
$feedback = array();
$wildcard = eZFindElevateConfiguration::WILDCARD;
$viewParameters = array();
$availableTranslations = eZContentLanguage::fetchList();
$thisUrl = '/ezfind/elevate';

// Elevation was triggered from the javascript menu ( content structure menu OR subitems menu )
if ( $http->hasPostVariable( 'ObjectIDFromMenu' ) and is_numeric( $http->postVariable( 'ObjectIDFromMenu' ) ) )
{
    $elevatedObject = eZContentObject::fetch( $http->postVariable( 'ObjectIDFromMenu' ) );

    $tpl->setVariable( 'back_from_browse', true );
    $tpl->setVariable( 'elevatedObject', $elevatedObject );
    $tpl->setVariable( 'elevateSearchQuery', '' );
}
コード例 #6
0
 public function executeBeforeLastRedirect($node)
 {
     $survey = $this->fetchFeedbackSurvey();
     $surveyQuestions = $this->feedbackQuestionList();
     $mailTo = $this->fetchMailTo($surveyQuestions);
     if ($survey = $this->fetchFeedbackSurvey() and $survey instanceof eZSurvey and $surveyQuestions = $this->feedbackQuestionList() and $mailTo = $this->fetchMailTo($surveyQuestions) and eZMail::validate($mailTo)) {
         require_once 'kernel/common/template.php';
         $tpl_email = templateInit();
         $tpl_email->setVariable('intro', $this->Text2);
         $tpl_email->setVariable('survey', $survey);
         $tpl_email->setVariable('survey_questions', $surveyQuestions);
         $tpl_email->setVariable('survey_node', $node);
         $templateResult = $tpl_email->fetch('design:survey/feedbackfield_mail.tpl');
         if (trim($this->Text3) != '') {
             $subject = $this->Text3;
         } else {
             $subject = $tpl_email->variable('subject');
         }
         $mail = new eZMail();
         $ini = eZINI::instance();
         $emailSender = $ini->variable('MailSettings', 'EmailSender');
         if (!$emailSender) {
             $emailSender = $ini->variable('MailSettings', 'AdminEmail');
         }
         $mail->setSenderText($emailSender);
         $mail->setReceiver($mailTo);
         $mail->setSubject($subject);
         $mail->setBody($templateResult);
         if ($this->Num == 1) {
             $adminReceiver = $ini->variable('MailSettings', 'AdminEmail');
             $mail->addBcc($adminReceiver);
         }
         $mailResult = eZMailTransport::send($mail);
     }
 }
コード例 #7
0
ファイル: ezsurveytype.php プロジェクト: netbliss/ezsurvey
 function processViewActions($objectAttribute, &$survey, &$validation)
 {
     $http = eZHTTPTool::instance();
     $actionContinue = false;
     $postNodeID = self::PREFIX_ATTRIBUTE . '_ezsurvey_node_id_' . $objectAttribute->attribute('id');
     $postContentObjectAttributeID = self::PREFIX_ATTRIBUTE . '_ezsurvey_contentobjectattribute_id_' . $objectAttribute->attribute('id');
     $postSurveyID = self::PREFIX_ATTRIBUTE . '_ezsurvey_id_' . $objectAttribute->attribute('id');
     $continueViewActions = true;
     if ($survey->attribute('one_answer') == 1) {
         $user = eZUser::currentUser();
         if ($user->isLoggedIn() === true) {
             $contentObjectID = $objectAttribute->attribute('contentobject_id');
             $contentClassAttributeID = $objectAttribute->attribute('contentclassattribute_id');
             $languageCode = $objectAttribute->attribute('language_code');
             $surveyID = $survey->attribute('id');
             $exist = eZSurveyResult::exist($surveyID, $user->attribute('contentobject_id'), $contentObjectID, $contentClassAttributeID, $languageCode);
             if ($exist === true) {
                 $continueViewActions = false;
             }
         } else {
             $continueViewActions = false;
         }
     }
     if ($continueViewActions === true) {
         if ($http->hasPostVariable($postNodeID) and $http->hasPostVariable($postContentObjectAttributeID) and $http->hasPostVariable($postSurveyID)) {
             $surveyID = $http->postVariable($postSurveyID);
             $contentObjectAttributeID = $http->postVariable($postContentObjectAttributeID);
             $nodeID = $http->postVariable($postNodeID);
             $node = eZContentObjectTreeNode::fetch($nodeID);
             if (get_class($node) == 'eZContentObjectTreeNode' and $node->canRead() === true) {
                 // verify that our attribute is included in this node.
                 $dataMap = $node->dataMap();
                 foreach ($dataMap as $attribute) {
                     $attributeObjectID = $attribute->attribute('id');
                     if ($attributeObjectID == $contentObjectAttributeID) {
                         $actionContinue = true;
                         break;
                     }
                 }
             } else {
                 if (get_class($node) == 'eZContentObjectTreeNode') {
                     eZDebug::writeWarning("Not enough permissions to read node with ID: " . $nodeID . ".", 'eZSurveyType::processViewActions');
                 } else {
                     eZDebug::writeWarning("node with ID: " . $nodeID . " does not exist.", 'eZSurveyType::processViewActions');
                     return false;
                 }
             }
         } else {
             eZDebug::writeWarning("All the postvariables {$postNodeID}, {$postContentObjectAttributeID} and {$postSurveyID} need to be supplied.", 'eZSurveyType::processViewActions');
             return false;
         }
         $nodeID = $http->postVariable($postNodeID);
         $node = eZContentObjectTreeNode::fetch($nodeID);
         if ($actionContinue === true) {
             $survey = eZSurvey::fetch($surveyID);
             $status = $survey->validateContentObjectAttributeID($contentObjectAttributeID);
             if (!$survey or !$survey->published() or !$survey->enabled() or !$survey->valid()) {
                 eZDebug::writeWarning('Survey is not valid', 'eZSurveyType::processViewActions');
                 return;
             }
             $params = array('prefix_attribute' => self::PREFIX_ATTRIBUTE, 'contentobjectattribute_id' => $contentObjectAttributeID);
             $variableArray = $survey->processViewActions($validation, $params);
             $postSurveyStoreButton = self::PREFIX_ATTRIBUTE . '_ezsurvey_store_button_' . $contentObjectAttributeID;
             $user = eZUser::currentUser();
             if ($survey->attribute('persistent')) {
                 $result = eZSurveyResult::instance($surveyID, $user->id());
             } else {
                 $result = eZSurveyResult::instance($surveyID);
             }
             $result->setAttribute('user_id', $user->id());
             $http = eZHTTPTool::instance();
             $sessionID = $http->sessionID();
             $result->setAttribute('user_session_id', $sessionID);
             if ($http->hasPostVariable($postSurveyStoreButton) && $validation['error'] == false) {
                 $result->storeResult($params);
                 $postReceiverID = self::PREFIX_ATTRIBUTE . '_ezsurvey_receiver_id_' . $contentObjectAttributeID;
                 if ($http->hasPostVariable($postReceiverID) and $questionList = $survey->fetchQuestionList() and $postReceiverQuestionID = $http->postVariable($postReceiverID) and isset($questionList[$postReceiverQuestionID])) {
                     $mailTo = $questionList[$postReceiverQuestionID]->answer();
                     $emailSenderList = explode('_', $questionList[$postReceiverQuestionID]->attribute('text3'));
                     if (isset($emailSenderList[1]) and $emailSenderID = $emailSenderList[1] and is_numeric($emailSenderID) and $emailSenderID > 0 and isset($questionList[$emailSenderID]) and $senderQuestion = $questionList[$emailSenderID] and $senderQuestion->attribute('type') == 'EmailEntry' and eZMail::validate($senderQuestion->attribute('answer'))) {
                         $emailSender = $senderQuestion->attribute('answer');
                     } else {
                         $ini = eZINI::instance();
                         $emailSender = $ini->variable('MailSettings', 'EmailSender');
                         if (!$emailSender) {
                             $emailSender = $ini->variable('MailSettings', 'AdminEmail');
                         }
                     }
                     require_once 'kernel/common/template.php';
                     $tpl_email = templateInit();
                     $tpl_email->setVariable('survey', $survey);
                     $tpl_email->setVariable('survey_questions', $questionList);
                     $tpl_email->setVariable('survey_node', $node);
                     $templateResult = $tpl_email->fetch('design:survey/mail.tpl');
                     $subject = $tpl_email->variable('subject');
                     $mail = new eZMail();
                     $mail->setSenderText($emailSender);
                     $mail->setReceiver($mailTo);
                     $mail->setSubject($subject);
                     $mail->setBody($templateResult);
                     $mailResult = eZMailTransport::send($mail);
                 }
                 $survey->executeBeforeLastRedirect($node);
                 $href = trim($survey->attribute('redirect_submit'));
                 $module = $GLOBALS['module'];
                 if ($module instanceof eZModule) {
                     if (trim($href) != "") {
                         if (preg_match("/^http:\\/\\/.+/", $href)) {
                             $module->redirectTo($href);
                         } else {
                             $originalHref = $href;
                             $status = eZURI::transformURI($href);
                             if ($status === true) {
                                 // Need to keep the original href, since it's
                                 // already changed here.
                                 $module->redirectTo($originalHref);
                             } else {
                                 $http->redirect($href);
                             }
                         }
                     }
                 }
             } else {
                 if ($validation['error'] == true and $survey->attribute('persistent') == true) {
                     // Fix prevous results.
                     $validation['post_variables']['active'] = true;
                     $validation['post_variables']['variables'] = $variableArray;
                 }
             }
         }
     } else {
         eZDebug::writeWarning('Answer for survey with userid: ' . $user->id() . ' does already exist', 'eZSurveyType::processViewActions');
         $validation['one_answer']['warning'] = true;
     }
 }
コード例 #8
0
ファイル: ezpaex.php プロジェクト: netbliss/ezmbpaex
 /**
  * Send password expiry notification to user
  *
  * @param eZUser $user ezuser object that contains the destination email address
  * @return true if notification sent correctly, false if not.
  */
 function sendExpiryNotification($user)
 {
     $userToSendEmail = $user;
     require_once "kernel/common/template.php";
     $receiver = $userToSendEmail->attribute('email');
     $mail = new eZMail();
     if (!$mail->validate($receiver)) {
         eZDebug::writeError('Invalid email address set in user ' . $user->attribute('contentobject_id'), 'sendExpiryNotification');
         return false;
     }
     $tpl = templateInit();
     $tpl->setVariable('user', $userToSendEmail);
     $http = eZHTTPTool::instance();
     $http->UseFullUrl = false;
     $templateResult = $tpl->fetch('design:userpaex/expirynotificationmail.tpl');
     $ini = eZINI::instance();
     $emailSender = $ini->variable('MailSettings', 'EmailSender');
     if (!$emailSender) {
         $emailSender = $ini->variable('MailSettings', 'AdminEmail');
     }
     $mail->setSender($emailSender);
     $mail->setReceiver($receiver);
     $subject = ezpI18n::tr('mbpaex/userpaex', 'Your password is about to expire');
     if ($tpl->hasVariable('subject')) {
         $subject = $tpl->variable('subject');
     }
     $mail->setSubject($subject);
     $mail->setBody($templateResult);
     return eZMailTransport::send($mail);
 }
コード例 #9
0
ファイル: sysinfotools.php プロジェクト: gggeek/ggsysinfo
 /**
  * Wrapper method to initialize a template and eventually takes advantage of new 4.3 TPL API
  * @return eZTemplate
  */
 public static function eZTemplateFactory()
 {
     if (eZPublishSDK::majorVersion() == 4 && eZPublishSDK::minorVersion() < 3) {
         include_once 'kernel/common/template.php';
         return templateInit();
     } else {
         return eZTemplate::factory();
     }
 }
コード例 #10
0
 function customObjectAttributeHTTPAction($http, $action, $contentObjectAttribute, $parameters)
 {
     switch ($action) {
         case "send_preview":
             $module = $parameters['module'];
             var_dump($module->obj);
             //viewData() );
             var_dump($obj);
             /*
                       $classAttribute = $contentObjectAttribute->contentClassAttribute();
                       var_dump($http);
                       var_dump($action);
                       var_dump($contentObjectAttribute);
                       var_dump
                       //$classAttribute = $contentObjectAttribute->contentClassAttribute();
                       //$module = $classAttribute->currentModule();
                       $module = $parameters['module'];
                       //var_dump($module);
                       
                       //var_dump($parameters);
                       $ObjectVersion = 26;
                       $ObjectID = 99;
                       $contentObject = ezContentObjectVersion::fetchVersion(  $ObjectVersion ,$ObjectID);
                       
                       $tpl =& templateInit();
                       $tpl->setVariable('object', $contentObject);
                       //$tpl->setVariable('newsletter', $newsletter);
                       $tpl->fetch( 'design:eznewsletter/newsletter_preview.tpl' );
             */
             /*
                     $cacheFileArray = array( 'cache_dir' => false, 'cache_path' => false );
                     $NodeID = 101;
                     
             //$Module = $Params['Module'];
             $tpl = templateInit();
             $LanguageCode = $Params['Language'];
             $ViewMode = "full";
             $Offset = $Params['Offset'];
             //$ini = eZINI::instance();
             $Year = $Params['Year'];
             $Month = $Params['Month'];
             $Day = $Params['Day'];
             $viewParameters = array( 'offset' => $Offset,
                                            'year' => $Year,
                                            'month' => $Month,
                                            'day' => $Day,
                                            'namefilter' => false );
             $viewParameters = array_merge( $viewParameters, $UserParameters );
             $collectionAttributes = false;
                   if ( isset( $Params['CollectionAttributes'] ) )
                     $collectionAttributes = $Params['CollectionAttributes'];
                   
                   $validation = array( 'processed' => false, 'attributes' => array() );
             
                   if ( isset( $Params['AttributeValidation'] ) )
                     $validation = $Params['AttributeValidation'];
                     
                   $localVars = array( "cacheFileArray", "NodeID",  "Module", "tpl",
                                           "LanguageCode",  "ViewMode", "Offset", "ini",
                                           "cacheFileArray", "viewParameters", "collectionAttributes",
                                           "validation" );
             
             
              
             
                     $args = compact( $localVars );
             
                     // the false parameter will disable generation of the 'binarydata' entry
                     $data = eZNodeviewfunctions::contentViewGenerate( false, $args ); 
             */
             $tpl = templateInit();
             $EditVersion = 26;
             $pathIdentificationString = "";
             $ObjectID = 99;
             $parentNodeID = 2;
             $virtualNodeID = null;
             $pathString = "";
             $depth = 2;
             $objectName = "OMG";
             $node = new eZContentObjectTreeNode();
             $node->setAttribute('contentobject_version', $EditVersion);
             $node->setAttribute('path_identification_string', $pathIdentificationString);
             $node->setAttribute('contentobject_id', $ObjectID);
             $node->setAttribute('parent_node_id', $parentNodeID);
             $node->setAttribute('main_node_id', $virtualNodeID);
             $node->setAttribute('path_string', $pathString);
             $node->setAttribute('depth', $depth);
             $node->setAttribute('node_id', $virtualNodeID);
             //$node->setAttribute( 'sort_field', $class->attribute( 'sort_field' ) );
             //$node->setAttribute( 'sort_order', $class->attribute( 'sort_order' ) );
             $node->setName($objectName);
             $node->setContentObject($contentObject);
             $contentObject = null;
             $LanguageCode = null;
             $viewParameters = array();
             $contentObject = eZContentObject::fetch($ObjectID);
             $Result = eZNodeviewfunctions::generateNodeViewData($tpl, $node, $contentObject, $LanguageCode, 'full', 0);
             var_dump($Result);
             //var_dump( $module->run("versionview") );
             $contentObjectAttribute->setValidationError(ezi18n('kernel/classes/datatypes', 'The email address is not valid.'));
     }
 }
コード例 #11
0
 /**
  * Get Name of NL User
  * use a tpl to have full flexebiltiy to render the name
  *
  * @return string
  */
 function getName()
 {
     $cjwNewsletterIni = eZINI::instance('cjw_newsletter.ini');
     $useTplForNameGeneration = $cjwNewsletterIni->variable('NewsletterUserSettings', 'UseTplForNameGeneration');
     if ($useTplForNameGeneration === 'enabled') {
         include_once 'kernel/common/template.php';
         $tpl = templateInit();
         $tpl->setVariable('nl_user', $this);
         $templateFile = 'design:newsletter/user/name.tpl';
         $name = strip_tags(trim($tpl->fetch($templateFile)));
         unset($tpl);
         return $name;
     } else {
         $name = trim($this->attribute('salutation_name') . ' ' . $this->attribute('first_name') . ' ' . $this->attribute('last_name'));
         return $name;
     }
 }
コード例 #12
0
ファイル: copy.php プロジェクト: stevoland/ez_patch
function chooseObjectVersionsToCopy($Module, &$Result, $object)
{
    $selectedNodeIDArray = eZContentBrowse::result($Module->currentAction());
    require_once 'kernel/common/template.php';
    $tpl = templateInit();
    $tpl->setVariable('object', $object);
    $tpl->setVariable('selected_node_id', $selectedNodeIDArray[0]);
    $Result['content'] = $tpl->fetch('design:content/copy.tpl');
    $Result['path'] = array(array('url' => false, 'text' => ezi18n('kernel/content', 'Content')), array('url' => false, 'text' => ezi18n('kernel/content', 'Copy')));
}
コード例 #13
0
 function modify($tpl, $operatorName, $operatorParameters, &$rootNamespace, &$currentNamespace, &$operatorValue, &$namedParameters)
 {
     switch ($operatorName) {
         case 'eztagcloud':
             $tags = array();
             $tagCloud = array();
             $parentNodeID = 0;
             $classIdentifier = '';
             $classIdentifierSQL = '';
             $pathString = '';
             $parentNodeIDSQL = '';
             $dbParams = array();
             $params = $namedParameters['params'];
             $orderBySql = 'ORDER BY ezkeyword.keyword ASC';
             if (isset($params['class_identifier'])) {
                 $classIdentifier = $params['class_identifier'];
             }
             if (isset($params['parent_node_id'])) {
                 $parentNodeID = $params['parent_node_id'];
             }
             if (isset($params['limit'])) {
                 $dbParams['limit'] = $params['limit'];
             }
             if (isset($params['offset'])) {
                 $dbParams['offset'] = $params['offset'];
             }
             if (isset($params['sort_by']) && is_array($params['sort_by']) && count($params['sort_by'])) {
                 $orderBySql = 'ORDER BY ';
                 $orderArr = is_string($params['sort_by'][0]) ? array($params['sort_by']) : $params['sort_by'];
                 foreach ($orderArr as $key => $order) {
                     if ($key !== 0) {
                         $orderBySql .= ', ';
                     }
                     $direction = isset($order[1]) ? $order[1] : false;
                     switch ($order[0]) {
                         case 'keyword':
                             $orderBySql .= 'ezkeyword.keyword ' . ($direction ? 'ASC' : 'DESC');
                             break;
                         case 'count':
                             $orderBySql .= 'keyword_count ' . ($direction ? 'ASC' : 'DESC');
                             break;
                     }
                 }
             }
             $db = eZDB::instance();
             if ($classIdentifier) {
                 $classID = eZContentObjectTreeNode::classIDByIdentifier($classIdentifier);
                 $classIdentifierSQL = "AND ezcontentobject.contentclass_id = '" . $classID . "'";
             }
             if ($parentNodeID) {
                 $node = eZContentObjectTreeNode::fetch($parentNodeID);
                 if ($node) {
                     $pathString = "AND ezcontentobject_tree.path_string like '" . $node->attribute('path_string') . "%'";
                 }
                 $parentNodeIDSQL = 'AND ezcontentobject_tree.node_id != ' . (int) $parentNodeID;
             }
             $showInvisibleNodesCond = eZContentObjectTreeNode::createShowInvisibleSQLString(true, false);
             $limitation = false;
             $limitationList = eZContentObjectTreeNode::getLimitationList($limitation);
             $sqlPermissionChecking = eZContentObjectTreeNode::createPermissionCheckingSQL($limitationList);
             $languageFilter = 'AND ' . eZContentLanguage::languagesSQLFilter('ezcontentobject');
             $rs = $db->arrayQuery("SELECT ezkeyword.keyword, count(ezkeyword.keyword) AS keyword_count\n                                        FROM ezkeyword,\n                                            ezkeyword_attribute_link\n                                            {$sqlPermissionChecking['from']}\n                                        LEFT JOIN ezcontentobject_attribute\n                                            ON ezkeyword_attribute_link.objectattribute_id = ezcontentobject_attribute.id\n                                        LEFT JOIN ezcontentobject\n                                            ON ezcontentobject_attribute.contentobject_id = ezcontentobject.id\n                                        LEFT JOIN ezcontentobject_tree\n                                            ON ezcontentobject_attribute.contentobject_id = ezcontentobject_tree.contentobject_id\n                                        WHERE ezkeyword.id = ezkeyword_attribute_link.keyword_id\n                                            AND ezcontentobject.status = " . eZContentObject::STATUS_PUBLISHED . "\n                                            AND ezcontentobject_attribute.version = ezcontentobject.current_version\n                                            AND ezcontentobject_tree.main_node_id = ezcontentobject_tree.node_id\n                                            {$pathString}\n                                            {$parentNodeIDSQL}\n                                            {$classIdentifierSQL}\n                                            {$showInvisibleNodesCond}\n                                            {$sqlPermissionChecking['where']}\n                                            {$languageFilter}\n                                        GROUP BY ezkeyword.id, ezkeyword.keyword\n                                        {$orderBySql}", $dbParams);
             foreach ($rs as $row) {
                 $tags[$row['keyword']] = $row['keyword_count'];
             }
             // To be able to combine count sorting with keyword sorting
             // without being limited by sql LIMIT result clipping
             if (isset($params['post_sort_by'])) {
                 if ($params['post_sort_by'] === 'keyword') {
                     ksort($tags, SORT_LOCALE_STRING);
                 } else {
                     if ($params['post_sort_by'] === 'keyword_reverse') {
                         krsort($tags, SORT_LOCALE_STRING);
                     } else {
                         if ($params['post_sort_by'] === 'count') {
                             asort($tags, SORT_NUMERIC);
                         } else {
                             if ($params['post_sort_by'] === 'count_reverse') {
                                 arsort($tags, SORT_NUMERIC);
                             }
                         }
                     }
                 }
             }
             $maxFontSize = 200;
             $minFontSize = 100;
             $maxCount = 0;
             $minCount = 0;
             if (count($tags) != 0) {
                 $maxCount = max(array_values($tags));
                 $minCount = min(array_values($tags));
             }
             $spread = $maxCount - $minCount;
             if ($spread == 0) {
                 $spread = 1;
             }
             $step = ($maxFontSize - $minFontSize) / $spread;
             foreach ($tags as $key => $value) {
                 $size = $minFontSize + ($value - $minCount) * $step;
                 $tagCloud[] = array('font_size' => $size, 'count' => $value, 'tag' => $key);
             }
             require_once 'kernel/common/template.php';
             $tpl = templateInit();
             $tpl->setVariable('tag_cloud', $tagCloud);
             $operatorValue = $tpl->fetch('design:tagcloud/tagcloud.tpl');
             break;
     }
 }
コード例 #14
0
ファイル: ezoexmlinput.php プロジェクト: stevoland/ez_soextra
 protected static function fetchTemplate($template, $parameters = array())
 {
     $tpl = templateInit();
     $existingPramas = array();
     foreach ($parameters as $name => $value) {
         if ($tpl->hasVariable($name)) {
             $existingPramas[$name] = $tpl->variable($name);
         }
         $tpl->setVariable($name, $value);
     }
     $result = $tpl->fetch($template);
     foreach ($parameters as $name => $value) {
         if (isset($existingPramas[$name])) {
             $tpl->setVariable($name, $existingPramas[$name]);
         } else {
             $tpl->unsetVariable($name);
         }
     }
     return $result;
 }
コード例 #15
0
                } else {
                    $warnings[] = "Row " . ($index + 1) . " skipped, subscriber exists." . " Email: '" . htmlspecialchars($row[1]) . "'";
                }
                continue;
            }
            $param_creation['attributes'] = array('name' => $row[0], 'email' => $row[1], 'subscriptions' => $subscriptions, 'status' => 'Approved');
            $object = eZContentFunctions::createAndPublishObject($param_creation);
            if ($object == false) {
                $warnings[] = "Row " . ($index + 1) . " skipped, failed to create subscriber with email: '" . htmlspecialchars($row[1]) . "'";
            } else {
                $warnings[] = "Row " . ($index + 1) . " added subscriber with" . " email: '" . htmlspecialchars($row[1]) . "'";
            }
        }
        if ($http->hasSessionVariable('CSVData')) {
            $http->removeSessionVariable('CSVData');
        }
        $data = array();
    }
} while (false);
$tpl =& templateInit();
//$tpl->setVariable( 'subscriptionListNode', $subscriptionListNode );
$tpl->setVariable('subscription_lists_node', $subscriptionListsNode);
$tpl->setVariable('add_to_subscription_lists', $addToSubscriptionLists);
$tpl->setVariable('CSVDelimiter', $delimiter);
$tpl->setVariable('data', $data);
$tpl->setVariable('row_selection', $rowSelection);
$tpl->setVariable('warnings', $warnings);
$Result = array();
$Result['left_menu'] = "design:parts/jnewsletter/menu.tpl";
$Result['content'] = $tpl->fetch('design:newsletter/users_import.tpl');
$Result['path'] = array(array('url' => false, 'text' => ezi18n('newsletter', 'Newsletter')));