本文整理汇总了PHP中FWUser::getParsedUserTitle方法的典型用法代码示例。如果您正苦于以下问题:PHP FWUser::getParsedUserTitle方法的具体用法?PHP FWUser::getParsedUserTitle怎么用?PHP FWUser::getParsedUserTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FWUser
的用法示例。
在下文中一共展示了FWUser::getParsedUserTitle方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getHomeTopNews
function getHomeTopNews($catId = 0)
{
global $_CORELANG, $objDatabase;
$catId = intval($catId);
$i = 0;
$this->_objTemplate->setTemplate($this->_pageContent, true, true);
if ($this->_objTemplate->blockExists('newsrow')) {
$this->_objTemplate->setCurrentBlock('newsrow');
} else {
return null;
}
$newsLimit = intval($this->arrSettings['news_top_limit']);
if ($newsLimit > 50) {
//limit to a maximum of 50 news
$newsLimit = 50;
}
if ($newsLimit < 1) {
//do not get any news if 0 was specified as the limit.
$objResult = false;
} else {
//fetch news
$objResult = $objDatabase->SelectLimit("\n SELECT DISTINCT(tblN.id) AS id,\n tblN.`date`, \n tblN.teaser_image_path,\n tblN.teaser_image_thumbnail_path,\n tblN.redirect,\n tblN.publisher,\n tblN.publisher_id,\n tblN.author,\n tblN.author_id,\n tblL.title AS title, \n tblL.teaser_text\n FROM " . DBPREFIX . "module_news AS tblN\n INNER JOIN " . DBPREFIX . "module_news_locale AS tblL ON tblL.news_id=tblN.id\n INNER JOIN " . DBPREFIX . "module_news_rel_categories AS tblC ON tblC.news_id=tblL.news_id\n WHERE tblN.status=1" . ($catId > 0 ? " AND tblC.category_id={$catId}" : '') . "\n AND tblN.teaser_only='0'\n AND tblL.lang_id=" . FRONTEND_LANG_ID . "\n AND (startdate<='" . date('Y-m-d H:i:s') . "' OR startdate='0000-00-00 00:00:00')\n AND (enddate>='" . date('Y-m-d H:i:s') . "' OR enddate='0000-00-00 00:00:00')" . ($this->arrSettings['news_message_protection'] == '1' && !\Permission::hasAllAccess() ? ($objFWUser = \FWUser::getFWUserObject()) && $objFWUser->objUser->login() ? " AND (frontend_access_id IN (" . implode(',', array_merge(array(0), $objFWUser->objUser->getDynamicPermissionIds())) . ") OR userid=" . $objFWUser->objUser->getId() . ") " : " AND frontend_access_id=0 " : '') . "ORDER BY\n (SELECT COUNT(*) FROM " . DBPREFIX . "module_news_stats_view WHERE news_id=tblN.id AND time>'" . date_format(date_sub(date_create('now'), date_interval_create_from_date_string(intval($this->arrSettings['news_top_days']) . ' day')), 'Y-m-d H:i:s') . "') DESC", $newsLimit);
}
if ($objResult !== false && $objResult->RecordCount()) {
while (!$objResult->EOF) {
$newsid = $objResult->fields['id'];
$newstitle = $objResult->fields['title'];
$author = \FWUser::getParsedUserTitle($objResult->fields['author_id'], $objResult->fields['author']);
$publisher = \FWUser::getParsedUserTitle($objResult->fields['publisher_id'], $objResult->fields['publisher']);
$newsCategories = $this->getCategoriesByNewsId($newsid);
$newsUrl = empty($objResult->fields['redirect']) ? \Cx\Core\Routing\Url::fromModuleAndCmd('News', $this->findCmdById('details', self::sortCategoryIdByPriorityId(array_keys($newsCategories), array($catId))), FRONTEND_LANG_ID, array('newsid' => $newsid)) : $objResult->fields['redirect'];
$htmlLink = self::parseLink($newsUrl, $newstitle, contrexx_raw2xhtml($newstitle));
list($image, $htmlLinkImage, $imageSource) = self::parseImageThumbnail($objResult->fields['teaser_image_path'], $objResult->fields['teaser_image_thumbnail_path'], $newstitle, $newsUrl);
$this->_objTemplate->setVariable(array('NEWS_ID' => $newsid, 'NEWS_CSS' => 'row' . ($i % 2 + 1), 'NEWS_LONG_DATE' => date(ASCMS_DATE_FORMAT, $objResult->fields['date']), 'NEWS_DATE' => date(ASCMS_DATE_FORMAT_DATE, $objResult->fields['date']), 'NEWS_TIME' => date(ASCMS_DATE_FORMAT_TIME, $objResult->fields['date']), 'NEWS_TITLE' => contrexx_raw2xhtml($newstitle), 'NEWS_TEASER' => nl2br($objResult->fields['teaser_text']), 'NEWS_LINK' => $htmlLink, 'NEWS_LINK_URL' => contrexx_raw2xhtml($newsUrl), 'NEWS_AUTHOR' => contrexx_raw2xhtml($author), 'NEWS_PUBLISHER' => contrexx_raw2xhtml($publisher)));
if (!empty($image)) {
$this->_objTemplate->setVariable(array('NEWS_IMAGE' => $image, 'NEWS_IMAGE_SRC' => contrexx_raw2xhtml($imageSource), 'NEWS_IMAGE_ALT' => contrexx_raw2xhtml($newstitle), 'NEWS_IMAGE_LINK' => $htmlLinkImage));
if ($this->_objTemplate->blockExists('news_image')) {
$this->_objTemplate->parse('news_image');
}
} else {
if ($this->_objTemplate->blockExists('news_image')) {
$this->_objTemplate->hideBlock('news_image');
}
}
self::parseImageBlock($this->_objTemplate, $objResult->fields['teaser_image_thumbnail_path'], $newstitle, $newsUrl, 'image_thumbnail');
self::parseImageBlock($this->_objTemplate, $objResult->fields['teaser_image_path'], $newstitle, $newsUrl, 'image_detail');
$this->_objTemplate->parseCurrentBlock();
$i++;
$objResult->MoveNext();
}
} else {
$this->_objTemplate->hideBlock('newsrow');
}
$this->_objTemplate->setVariable("TXT_MORE_NEWS", $_CORELANG['TXT_MORE_NEWS']);
return $this->_objTemplate->get();
}
示例2: getHomeHeadlines
function getHomeHeadlines($catId = 0)
{
global $_CORELANG, $objDatabase, $_LANGID;
$i = 0;
$catId = intval($catId);
$this->_objTemplate->setTemplate($this->_pageContent, true, true);
$newsLimit = intval($this->arrSettings['news_headlines_limit']);
if ($newsLimit > 50) {
//limit to a maximum of 50 news
$newsLimit = 50;
}
if ($newsLimit < 1) {
//do not get any news if 0 was specified as the limit.
$objResult = false;
} else {
//fetch news
$objResult = $objDatabase->SelectLimit("\n SELECT DISTINCT(tblN.id) AS id,\n tblN.`date`, \n tblN.teaser_image_path,\n tblN.teaser_image_thumbnail_path,\n tblN.redirect,\n tblN.publisher,\n tblN.publisher_id,\n tblN.author,\n tblN.author_id,\n tblL.text NOT REGEXP '^(<br type=\"_moz\" />)?\$' AS newscontent,\n tblL.title AS title, \n tblL.teaser_text\n FROM " . DBPREFIX . "module_news AS tblN\n INNER JOIN " . DBPREFIX . "module_news_locale AS tblL ON tblL.news_id=tblN.id\n INNER JOIN " . DBPREFIX . "module_news_rel_categories AS tblC ON tblC.news_id=tblL.news_id\n WHERE tblN.status=1" . ($catId > 0 ? " AND tblC.category_id={$catId}" : '') . "\n AND tblN.teaser_only='0'\n AND tblL.lang_id=" . $_LANGID . "\n AND tblL.is_active=1\n AND (startdate<='" . date('Y-m-d H:i:s') . "' OR startdate='0000-00-00 00:00:00')\n AND (enddate>='" . date('Y-m-d H:i:s') . "' OR enddate='0000-00-00 00:00:00')" . ($this->arrSettings['news_message_protection'] == '1' && !\Permission::hasAllAccess() ? ($objFWUser = \FWUser::getFWUserObject()) && $objFWUser->objUser->login() ? " AND (frontend_access_id IN (" . implode(',', array_merge(array(0), $objFWUser->objUser->getDynamicPermissionIds())) . ") OR userid=" . $objFWUser->objUser->getId() . ") " : " AND frontend_access_id=0 " : '') . "ORDER BY date DESC", $newsLimit);
}
if ($objResult !== false && $objResult->RecordCount() >= 0) {
while (!$objResult->EOF) {
$newsid = $objResult->fields['id'];
$newstitle = $objResult->fields['title'];
$newsCategories = $this->getCategoriesByNewsId($newsid);
$newsUrl = empty($objResult->fields['redirect']) ? empty($objResult->fields['newscontent']) ? '' : \Cx\Core\Routing\Url::fromModuleAndCmd('News', $this->findCmdById('details', self::sortCategoryIdByPriorityId(array_keys($newsCategories), array($catId))), FRONTEND_LANG_ID, array('newsid' => $newsid)) : $objResult->fields['redirect'];
$htmlLink = self::parseLink($newsUrl, $newstitle, contrexx_raw2xhtml($newstitle), 'headlineLink');
$htmlLinkTitle = self::parseLink($newsUrl, $newstitle, contrexx_raw2xhtml($newstitle));
// in case that the message is a stub, we shall just display the news title instead of a html-a-tag with no href target
if (empty($htmlLinkTitle)) {
$htmlLinkTitle = contrexx_raw2xhtml($newstitle);
}
list($image, $htmlLinkImage, $imageSource) = self::parseImageThumbnail($objResult->fields['teaser_image_path'], $objResult->fields['teaser_image_thumbnail_path'], $newstitle, $newsUrl);
$author = \FWUser::getParsedUserTitle($objResult->fields['author_id'], $objResult->fields['author']);
$publisher = \FWUser::getParsedUserTitle($objResult->fields['publisher_id'], $objResult->fields['publisher']);
$this->_objTemplate->setVariable(array('NEWS_ID' => $newsid, 'NEWS_CSS' => 'row' . ($i % 2 + 1), 'NEWS_LONG_DATE' => date(ASCMS_DATE_FORMAT, $objResult->fields['date']), 'NEWS_DATE' => date(ASCMS_DATE_FORMAT_DATE, $objResult->fields['date']), 'NEWS_TIME' => date(ASCMS_DATE_FORMAT_TIME, $objResult->fields['date']), 'NEWS_TITLE' => contrexx_raw2xhtml($newstitle), 'NEWS_TEASER' => nl2br($objResult->fields['teaser_text']), 'NEWS_LINK_TITLE' => $htmlLinkTitle, 'NEWS_LINK' => $htmlLink, 'NEWS_LINK_URL' => contrexx_raw2xhtml($newsUrl), 'NEWS_AUTHOR' => contrexx_raw2xhtml($author), 'NEWS_PUBLISHER' => contrexx_raw2xhtml($publisher), 'HEADLINE_ID' => $newsid, 'HEADLINE_DATE' => date(ASCMS_DATE_FORMAT_DATE, $objResult->fields['date']), 'HEADLINE_TEXT' => nl2br($objResult->fields['teaser_text']), 'HEADLINE_LINK' => $htmlLinkTitle, 'HEADLINE_AUTHOR' => contrexx_raw2xhtml($author)));
if (!empty($image)) {
$this->_objTemplate->setVariable(array('NEWS_IMAGE' => $image, 'NEWS_IMAGE_SRC' => contrexx_raw2xhtml($imageSource), 'NEWS_IMAGE_ALT' => contrexx_raw2xhtml($newstitle), 'NEWS_IMAGE_LINK' => $htmlLinkImage, 'HEADLINE_IMAGE_PATH' => contrexx_raw2xhtml($objResult->fields['teaser_image_path']), 'HEADLINE_THUMBNAIL_PATH' => contrexx_raw2xhtml($imageSource)));
if ($this->_objTemplate->blockExists('news_image')) {
$this->_objTemplate->parse('news_image');
}
} else {
if ($this->_objTemplate->blockExists('news_image')) {
$this->_objTemplate->hideBlock('news_image');
}
}
self::parseImageBlock($this->_objTemplate, $objResult->fields['teaser_image_thumbnail_path'], $newstitle, $newsUrl, 'image_thumbnail');
self::parseImageBlock($this->_objTemplate, $objResult->fields['teaser_image_path'], $newstitle, $newsUrl, 'image_detail');
$this->_objTemplate->parse('headlines_row');
$i++;
$objResult->MoveNext();
}
} else {
$this->_objTemplate->hideBlock('headlines_row');
}
$this->_objTemplate->setVariable("TXT_MORE_NEWS", $_CORELANG['TXT_MORE_NEWS']);
return $this->_objTemplate->get();
}
示例3: user
private function user(&$metaPageTitle, &$pageTitle)
{
global $_CONFIG;
$objFWUser = \FWUser::getFWUserObject();
$objUser = $objFWUser->objUser->getUser(!empty($_REQUEST['id']) ? intval($_REQUEST['id']) : 0);
if ($objUser) {
if ($objUser->getProfileAccess() != 'everyone') {
if (!$objFWUser->objUser->login()) {
\Cx\Core\Csrf\Controller\Csrf::header('Location: ' . CONTREXX_DIRECTORY_INDEX . '?section=Login&redirect=' . base64_encode(ASCMS_PROTOCOL . '://' . $_CONFIG['domainUrl'] . CONTREXX_SCRIPT_PATH . '?section=Access&cmd=user&id=' . $objUser->getId()));
exit;
}
if ($objUser->getId() != $objFWUser->objUser->getId() && $objUser->getProfileAccess() == 'nobody' && !$objFWUser->objUser->getAdminStatus()) {
\Cx\Core\Csrf\Controller\Csrf::header('Location: ' . CONTREXX_DIRECTORY_INDEX . '?section=Login&cmd=noaccess&redirect=' . base64_encode(ASCMS_PROTOCOL . '://' . $_CONFIG['domainUrl'] . CONTREXX_SCRIPT_PATH . '?section=Access&cmd=user&id=' . $objUser->getId()));
exit;
}
}
$metaPageTitle = \FWUser::getParsedUserTitle($objUser);
$pageTitle = contrexx_raw2xhtml(\FWUser::getParsedUserTitle($objUser));
$this->_objTpl->setGlobalVariable(array('ACCESS_USER_ID' => $objUser->getId(), 'ACCESS_USER_USERNAME' => contrexx_raw2xhtml($objUser->getUsername()), 'ACCESS_USER_PRIMARY_GROUP' => contrexx_raw2xhtml($objUser->getPrimaryGroupName())));
if ($objUser->getEmailAccess() == 'everyone' || $objFWUser->objUser->login() && ($objUser->getId() == $objFWUser->objUser->getId() || $objUser->getEmailAccess() == 'members_only' || $objFWUser->objUser->getAdminStatus())) {
$this->parseAccountAttribute($objUser, 'email');
} elseif ($this->_objTpl->blockExists('access_user_email')) {
$this->_objTpl->hideBlock('access_user_email');
}
$nr = 0;
while (!$objUser->objAttribute->EOF) {
$objAttribute = $objUser->objAttribute->getById($objUser->objAttribute->getId());
$this->parseAttribute($objUser, $objAttribute->getId(), 0, false, false, false, false, true, array('_CLASS' => $nr % 2 + 1)) ? $nr++ : false;
$objUser->objAttribute->next();
}
$this->_objTpl->setVariable("ACCESS_REFERER", $_SERVER['HTTP_REFERER']);
} else {
// or would it be better to redirect to the home page?
\Cx\Core\Csrf\Controller\Csrf::header('Location: index.php?section=Access&cmd=members');
exit;
}
}
示例4: getViewGeneratorOptions
/**
* This function returns the ViewGeneration options for a given entityClass
*
* @access protected
* @global $_ARRAYLANG
* @param $entityClassName contains the FQCN from entity
* @return array with options
*/
protected function getViewGeneratorOptions($entityClassName)
{
global $_ARRAYLANG;
$classNameParts = explode('\\', $entityClassName);
$classIdentifier = end($classNameParts);
$langVarName = 'TXT_' . strtoupper($this->getType() . '_' . $this->getName() . '_ACT_' . $classIdentifier);
$header = '';
if (isset($_ARRAYLANG[$langVarName])) {
$header = $_ARRAYLANG[$langVarName];
}
switch ($entityClassName) {
case 'Cx\\Modules\\Order\\Model\\Entity\\Order':
return array('header' => $_ARRAYLANG['TXT_MODULE_ORDER_ACT_DEFAULT'], 'functions' => array('add' => true, 'edit' => true, 'delete' => true, 'sorting' => true, 'paging' => true, 'filtering' => false), 'fields' => array('contactId' => array('header' => 'contactId', 'table' => array('parse' => function ($value) {
global $_ARRAYLANG;
$userId = \Cx\Modules\Crm\Controller\CrmLibrary::getUserIdByCrmUserId($value);
$userName = \FWUser::getParsedUserTitle($userId);
$crmDetailLink = "<a href='index.php?cmd=Crm&act=customers&tpl=showcustdetail&id={$value}'\n title='{$_ARRAYLANG['TXT_MODULE_ORDER_CRM_CONTACT']}'>\n <img\n src='" . \Env::get('cx')->getCodeBaseCoreWebPath() . "/Core/View/Media/navigation_level_1_189.png'\n width='16' height='16'\n alt='{$_ARRAYLANG['TXT_MODULE_ORDER_CRM_CONTACT']}'\n />\n </a>";
$url = "<a href='index.php?cmd=Access&act=user&tpl=modify&id={$userId}'\n title='{$_ARRAYLANG['TXT_MODULE_ORDER_MODIY_USER_ACCOUNT']}'>" . $userName . "</a>" . $crmDetailLink;
return $url;
})), 'subscriptions' => array('header' => 'subscriptions', 'table' => array('parse' => function ($subscriptions) {
$result = array();
foreach ($subscriptions as $subscription) {
$productEntity = $subscription->getProductEntity();
if (!$productEntity) {
continue;
}
$productEntityName = $subscription->getProduct()->getName();
$productEditLink = $productEntity;
if (method_exists($productEntity, 'getEditLink')) {
$productEditLink = $productEntity->getEditLink();
}
$subscriptionEditUrl = '<a href=index.php?cmd=Order&act=subscription&editid=' . $subscription->getId() . '>' . $productEntityName . '</a>';
$result[] = $subscriptionEditUrl . ' (' . $productEditLink . ')';
}
return implode(', ', $result);
}))));
break;
case 'Cx\\Modules\\Order\\Model\\Entity\\Subscription':
return array('header' => $_ARRAYLANG['TXT_MODULE_ORDER_ACT_SUBSCRIPTION'], 'functions' => array('add' => true, 'edit' => true, 'delete' => true, 'sorting' => true, 'paging' => true, 'filtering' => false), 'fields' => array('id' => array('header' => $_ARRAYLANG['TXT_MODULE_ORDER_SUBSCRIPTION_ID']), 'subscriptionDate' => array('header' => $_ARRAYLANG['TXT_MODULE_ORDER_SUBSCRIPTION_DATE']), 'expirationDate' => array('header' => $_ARRAYLANG['TXT_MODULE_ORDER_SUBSCRIPTION_EXPIRATION_DATE']), 'productEntityId' => array('header' => $_ARRAYLANG['TXT_MODULE_ORDER_SUBSCRIPTION_PRODUCT_ENTITY'], 'table' => array('parse' => function ($value, $rowData) {
$subscriptionRepo = \Env::get('em')->getRepository('Cx\\Modules\\Order\\Model\\Entity\\Subscription');
$subscription = $subscriptionRepo->findOneBy(array('id' => $rowData['id']));
$productEntity = $subscription->getProductEntity();
if (!$productEntity) {
return;
}
$productEditLink = $productEntity;
if (method_exists($productEntity, 'getEditLink')) {
$productEditLink = $productEntity->getEditLink();
}
return $productEditLink;
})), 'paymentAmount' => array('header' => $_ARRAYLANG['TXT_MODULE_ORDER_SUBSCRIPTION_PAYMENT_AMOUNT'], 'table' => array('parse' => function ($value, $rowData) {
if (\FWValidator::isEmpty(floatval($value))) {
return null;
}
$subscriptionRepo = \Env::get('em')->getRepository('Cx\\Modules\\Order\\Model\\Entity\\Subscription');
$subscription = $subscriptionRepo->findOneBy(array('id' => $rowData['id']));
$currency = '';
$order = $subscription->getOrder();
if ($order) {
$currency = !\FWValidator::isEmpty($order->getCurrency()) ? $order->getCurrency() : '';
}
$paymentInterval = $subscription->getRenewalUnit();
return $value . ' ' . $currency . ' / ' . $paymentInterval;
})), 'renewalUnit' => array('header' => $_ARRAYLANG['TXT_MODULE_ORDER_SUBSCRIPTION_RENEWAL_UNIT'], 'table' => array('parse' => function ($value, $rowData) {
if (empty($value)) {
return null;
}
$subscriptionRepo = \Env::get('em')->getRepository('Cx\\Modules\\Order\\Model\\Entity\\Subscription');
$subscription = $subscriptionRepo->findOneBy(array('id' => $rowData['id']));
$renewalDate = '';
if ($subscription->getRenewalDate()) {
$renewalDate = $subscription->getRenewalDate();
$quantifier = $subscription->getRenewalQuantifier();
$renewalDate->modify("-{$quantifier} {$value}");
return $renewalDate->format('d.M.Y H:i:s');
}
return $renewalDate;
})), 'renewalQuantifier' => array('showOverview' => false), 'renewalDate' => array('header' => $_ARRAYLANG['TXT_MODULE_ORDER_SUBSCRIPTION_RENEWAL_DATE']), 'description' => array('header' => $_ARRAYLANG['TXT_MODULE_ORDER_SUBSCRIPTION_DESCRIPTION']), 'state' => array('header' => $_ARRAYLANG['TXT_MODULE_ORDER_SUBSCRIPTION_STATE']), 'terminationDate' => array('header' => $_ARRAYLANG['TXT_MODULE_ORDER_SUBSCRIPTION_TERMI_DATE']), 'note' => array('header' => $_ARRAYLANG['TXT_MODULE_ORDER_SUBSCRIPTION_NOTE']), 'product' => array('header' => $_ARRAYLANG['TXT_MODULE_ORDER_SUBSCRIPTION_PRODUCT'], 'table' => array('parse' => function ($value, $rowData) {
$subscriptionRepo = \Env::get('em')->getRepository('Cx\\Modules\\Order\\Model\\Entity\\Subscription');
$subscription = $subscriptionRepo->findOneBy(array('id' => $rowData['id']));
$product = $subscription->getProduct();
if (!$product) {
return;
}
return $product->getName();
})), 'paymentState' => array('showOverview' => false), 'externalSubscriptionId' => array('showOverview' => false), 'order' => array('showOverview' => false)));
break;
default:
return array('header' => $header, 'functions' => array('add' => true, 'edit' => true, 'delete' => true, 'sorting' => true, 'paging' => true, 'filtering' => false));
}
}
示例5: notifyStaffOnContactAccModification
/**
* notify the staffs regarding the account modification of a contact
*
* @param Integer $customerId customer id
* @param String $first_name customer first name
* @param String $last_name customer last name
*
* @access public
* @global object $objTemplate
* @global array $_ARRAYLANG
*
* @return null
*/
public function notifyStaffOnContactAccModification($customerId = 0, $first_name = '', $last_name = '', $gender = 0)
{
global $objDatabase, $_ARRAYLANG;
if (empty($customerId)) {
return false;
}
$objFWUser = \FWUser::getFWUserObject();
$settings = $this->getSettings();
$resources = $this->getResources($settings['emp_default_user_group']);
$customer_name = $first_name . " " . $last_name;
$contact_gender = $gender == 1 ? "gender_female" : ($gender == 2 ? "gender_male" : 'gender_undefined');
$emailIds = array();
foreach ($resources as $key => $value) {
$emailIds[] = $value['email'];
}
$cx = \Cx\Core\Core\Controller\Cx::instanciate();
foreach ($emailIds as $emails) {
if (!empty($emails)) {
$objUsers = $objFWUser->objUser->getUsers($filter = array('email' => addslashes($emails)));
$info['substitution'] = array('CRM_ASSIGNED_USER_NAME' => contrexx_raw2xhtml(\FWUser::getParsedUserTitle($objUsers->getId())), 'CRM_ASSIGNED_USER_EMAIL' => $emails, 'CRM_CONTACT_FIRSTNAME' => contrexx_raw2xhtml($first_name), 'CRM_CONTACT_LASTNAME' => contrexx_raw2xhtml($last_name), 'CRM_CONTACT_GENDER' => contrexx_raw2xhtml($contact_gender), 'CRM_DOMAIN' => ASCMS_PROTOCOL . "://{$_SERVER['HTTP_HOST']}" . $cx->getCodeBaseOffsetPath(), 'CRM_CONTACT_DETAILS_URL' => ASCMS_PROTOCOL . "://{$_SERVER['HTTP_HOST']}" . $cx->getCodeBaseOffsetPath() . $cx->getBackendFolderName() . "/index.php?cmd=" . $this->moduleName . "&act=customers&tpl=showcustdetail&id={$customerId}", 'CRM_CONTACT_DETAILS_LINK' => "<a href='" . ASCMS_PROTOCOL . "://{$_SERVER['HTTP_HOST']}" . $cx->getCodeBaseOffsetPath() . $cx->getBackendFolderName() . "/index.php?cmd=" . $this->moduleName . "&act=customers&tpl=showcustdetail&id={$customerId}'>" . $customer_name . "</a>");
//setting email template lang id
$availableMailTempLangAry = $this->getActiveEmailTemLangId('Crm', CRM_EVENT_ON_ACCOUNT_UPDATED);
$availableLangId = $this->getEmailTempLang($availableMailTempLangAry, $emails);
$info['lang_id'] = $availableLangId;
$dispatcher = CrmEventDispatcher::getInstance();
$dispatcher->triggerEvent(CRM_EVENT_ON_ACCOUNT_UPDATED, null, $info);
}
}
}
示例6: getArchive
/**
* Get a list of all news messages sorted by year and month.
*
* @access private
* @return string parsed content
*/
private function getArchive()
{
global $objDatabase, $_ARRAYLANG;
$categories = '';
$i = 0;
if ($categories = substr($_REQUEST['cmd'], 7)) {
$categories = $this->getCatIdsFromNestedSetArray($this->getNestedSetCategories(explode(',', $categories)));
}
$monthlyStats = $this->getMonthlyNewsStats($categories);
if (!empty($monthlyStats)) {
foreach ($monthlyStats as $key => $value) {
$this->_objTpl->setVariable(array('NEWS_ARCHIVE_MONTH_KEY' => $key, 'NEWS_ARCHIVE_MONTH_NAME' => $value['name'], 'NEWS_ARCHIVE_MONTH_COUNT' => count($value['news'])));
$this->_objTpl->parse('news_archive_months_list_item');
foreach ($value['news'] as $news) {
$newsid = $news['id'];
$newstitle = $news['newstitle'];
$newsCategories = $this->getCategoriesByNewsId($newsid);
$newsCommentActive = $news['commentactive'];
$newsUrl = empty($news['newsredirect']) ? empty($news['newscontent']) ? '' : \Cx\Core\Routing\Url::fromModuleAndCmd('News', $this->findCmdById('details', self::sortCategoryIdByPriorityId(array_keys($newsCategories), $categories)), FRONTEND_LANG_ID, array('newsid' => $newsid)) : $news['newsredirect'];
$htmlLink = self::parseLink($newsUrl, $newstitle, contrexx_raw2xhtml('[' . $_ARRAYLANG['TXT_NEWS_MORE'] . '...]'));
list($image, $htmlLinkImage, $imageSource) = self::parseImageThumbnail($news['teaser_image_path'], $news['teaser_image_thumbnail_path'], $newstitle, $newsUrl);
$author = \FWUser::getParsedUserTitle($news['author_id'], $news['author']);
$publisher = \FWUser::getParsedUserTitle($news['publisher_id'], $news['publisher']);
$objResult = $objDatabase->Execute('SELECT count(`id`) AS `countComments` FROM `' . DBPREFIX . 'module_news_comments` WHERE `newsid` = ' . $newsid);
$this->_objTpl->setVariable(array('NEWS_ARCHIVE_ID' => $newsid, 'NEWS_ARCHIVE_CSS' => 'row' . ($i % 2 + 1), 'NEWS_ARCHIVE_TEASER' => nl2br($news['teaser_text']), 'NEWS_ARCHIVE_TITLE' => contrexx_raw2xhtml($newstitle), 'NEWS_ARCHIVE_LONG_DATE' => date(ASCMS_DATE_FORMAT, $news['newsdate']), 'NEWS_ARCHIVE_DATE' => date(ASCMS_DATE_FORMAT_DATE, $news['newsdate']), 'NEWS_ARCHIVE_TIME' => date(ASCMS_DATE_FORMAT_TIME, $news['newsdate']), 'NEWS_ARCHIVE_LINK_TITLE' => contrexx_raw2xhtml($newstitle), 'NEWS_ARCHIVE_LINK' => $htmlLink, 'NEWS_ARCHIVE_LINK_URL' => contrexx_raw2xhtml($newsUrl), 'NEWS_ARCHIVE_CATEGORY' => stripslashes($news['name']), 'NEWS_ARCHIVE_AUTHOR' => contrexx_raw2xhtml($author), 'NEWS_ARCHIVE_PUBLISHER' => contrexx_raw2xhtml($publisher), 'NEWS_ARCHIVE_COUNT_COMMENTS' => contrexx_raw2xhtml($objResult->fields['countComments'] . ' ' . $_ARRAYLANG['TXT_NEWS_COMMENTS'])));
if (!$newsCommentActive || !$this->arrSettings['news_comments_activated']) {
if ($this->_objTpl->blockExists('news_archive_comments_count')) {
$this->_objTpl->hideBlock('news_archive_comments_count');
}
}
if (!empty($image)) {
$this->_objTpl->setVariable(array('NEWS_ARCHIVE_IMAGE' => $image, 'NEWS_ARCHIVE_IMAGE_SRC' => contrexx_raw2xhtml($imageSource), 'NEWS_ARCHIVE_IMAGE_ALT' => contrexx_raw2xhtml($newstitle), 'NEWS_ARCHIVE_IMAGE_LINK' => $htmlLinkImage));
if ($this->_objTpl->blockExists('news_archive_image')) {
$this->_objTpl->parse('news_archive_image');
}
} elseif ($this->_objTpl->blockExists('news_archive_image')) {
$this->_objTpl->hideBlock('news_archive_image');
}
self::parseImageBlock($this->_objTpl, $news['teaser_image_thumbnail_path'], $newstitle, $newsUrl, 'archive_image_thumbnail');
self::parseImageBlock($this->_objTpl, $news['teaser_image_path'], $newstitle, $newsUrl, 'archive_image_detail');
$this->_objTpl->parse('news_archive_link');
$i++;
}
$this->_objTpl->setVariable(array('NEWS_ARCHIVE_MONTH_KEY' => $key, 'NEWS_ARCHIVE_MONTH_NAME' => $value['name']));
$this->_objTpl->parse('news_archive_month_list_item');
}
$this->_objTpl->parse('news_archive_months_list');
$this->_objTpl->parse('news_archive_month_list');
if ($this->_objTpl->blockExists('news_archive_status_message')) {
$this->_objTpl->hideBlock('news_archive_status_message');
}
} else {
$this->_objTpl->setVariable('TXT_NEWS_NO_NEWS_FOUND', $_ARRAYLANG['TXT_NEWS_NO_NEWS_FOUND']);
if ($this->_objTpl->blockExists('news_archive_status_message')) {
$this->_objTpl->parse('news_archive_status_message');
}
$this->_objTpl->hideblock('news_archive_months_list');
$this->_objTpl->hideBlock('news_archive_month_list');
}
return $this->_objTpl->get();
}
示例7: parseRelatedNews
/**
* Parsing the related News
*
* @global object $objDatabase
* @global type $_ARRAYLANG
*
* @param Object $objTpl Template Object
* @param Interger $newsId News Id
* @param Interger $langId Language id
* @param type $blockName Block Name
* @param type $limit Limit
*
* @return null
*/
public function parseRelatedNews(\Cx\Core\Html\Sigma $objTpl, $newsId = null, $langId = null, $blockName = 'related_news', $limit = 0)
{
global $_ARRAYLANG, $objDatabase;
if (empty($newsId) || !$objTpl->blockExists($blockName)) {
return;
}
//Getting the related news ids
$relatedNewsIds = $this->getRelatedNews($newsId);
$defaultLangId = \FWLanguage::getDefaultLangId();
//Getting the related news details for the given languages
$relatedNewsDetails = $this->getRelatedNewsDetails($relatedNewsIds, array($langId, $defaultLangId));
if (!empty($relatedNewsDetails)) {
$defaultImage = \Cx\Core\Core\Controller\Cx::instanciate()->getCodeBaseCoreModulePath() . '/News/View/Media/default_news_image.png';
$currentCount = 1;
foreach ($relatedNewsIds as $relatedNewsId) {
//If the limit is reached then the loop is stopped
if (!empty($limit) && $currentCount > $limit) {
break;
}
/*
* Checking the related news is available in the current
* acitve front-end language if not available then the default
* language details are getting used
* Comment/Uncomment the following line if this condition
* is required
*/
//$currentRelatedDetails = isset($relatedNewsDetails[$relatedNewsId][$langId])
// ? $relatedNewsDetails[$relatedNewsId][$langId]
// : $relatedNewsDetails[$relatedNewsId][$defaultLangId];
/*
* Checking the related news is available in the current
* acitve front-end language if not available then the related
* News not listed Comment/Uncomment the following
* line if this condition is required
*/
$currentRelatedDetails = isset($relatedNewsDetails[$relatedNewsId][$langId]) ? $relatedNewsDetails[$relatedNewsId][$langId] : false;
if (!$currentRelatedDetails) {
continue;
}
++$currentCount;
$categories = $this->getCategoriesByNewsId($relatedNewsId);
$newsUrl = empty($currentRelatedDetails['redirect']) ? empty($currentRelatedDetails['newscontent']) ? '' : \Cx\Core\Routing\Url::fromModuleAndCmd('news', $this->findCmdById('details', array_keys($categories)), FRONTEND_LANG_ID, array('newsid' => $relatedNewsId)) : $currentRelatedDetails['redirect'];
$newstitle = $currentRelatedDetails['title'];
$htmlLink = self::parseLink($newsUrl, $newstitle, contrexx_raw2xhtml('[' . $_ARRAYLANG['TXT_NEWS_MORE'] . '...]'));
$htmlLinkTitle = self::parseLink($newsUrl, $newstitle, contrexx_raw2xhtml($newstitle));
// in case that the message is a stub,
// we shall just display the news title instead of a html-a-tag
// with no href target
if (empty($htmlLinkTitle)) {
$htmlLinkTitle = contrexx_raw2xhtml($newstitle);
}
$imagePath = !empty($currentRelatedDetails['teaser_image_path']) ? $currentRelatedDetails['teaser_image_path'] : $defaultImage;
$imageThumbPath = !empty($currentRelatedDetails['teaser_image_thumbnail_path']) ? $currentRelatedDetails['teaser_image_thumbnail_path'] : $defaultImage;
$this->parseImageBlock($objTpl, $imagePath, $newstitle, $newsUrl, 'related_news_image');
$this->parseImageBlock($objTpl, $imageThumbPath, $newstitle, $newsUrl, 'related_news_image_thumb');
$author = \FWUser::getParsedUserTitle($currentRelatedDetails['author_id'], $currentRelatedDetails['author']);
$publisher = \FWUser::getParsedUserTitle($currentRelatedDetails['publisher_id'], $currentRelatedDetails['publisher']);
$objSubResult = $objDatabase->Execute('
SELECT count(`id`) AS `countComments`
FROM `' . DBPREFIX . 'module_news_comments`
WHERE `newsid` = ' . $relatedNewsId);
$objTpl->setVariable(array('NEWS_RELATED_NEWS_ID' => contrexx_raw2xhtml($relatedNewsId), 'NEWS_RELATED_NEWS_URL' => contrexx_raw2xhtml($newsUrl), 'NEWS_RELATED_NEWS_LINK' => $htmlLink, 'NEWS_RELATED_NEWS_TITLE' => contrexx_raw2xhtml($currentRelatedDetails['title']), 'NEWS_RELATED_NEWS_TITLE_SHORT' => strlen($currentRelatedDetails['title']) > 35 ? substr(strip_tags($currentRelatedDetails['title']), 0, 35) . '...' : strip_tags($currentRelatedDetails['title']), 'NEWS_RELATED_NEWS_TITLE_LINK' => $htmlLinkTitle, 'NEWS_RELATED_NEWS_TEXT' => $currentRelatedDetails['text'], 'NEWS_RELATED_NEWS_TEXT_SHORT' => strlen($currentRelatedDetails['text']) > 250 ? substr(strip_tags($currentRelatedDetails['text']), 0, 247) . '...' : strip_tags($currentRelatedDetails['text']), 'NEWS_RELATED_NEWS_TEASER_TEXT' => nl2br($currentRelatedDetails['teaser_text']), 'NEWS_RELATED_NEWS_AUTHOR' => contrexx_raw2xhtml($author), 'NEWS_RELATED_NEWS_PUBLISHER' => contrexx_raw2xhtml($publisher), 'NEWS_RELATED_NEWS_CATEGORY_NAMES' => implode(', ', contrexx_raw2xhtml($categories)), 'NEWS_RELATED_NEWS_LONG_DATE' => date(ASCMS_DATE_FORMAT, $currentRelatedDetails['newsdate']), 'NEWS_RELATED_NEWS_DATE' => date(ASCMS_DATE_FORMAT_DATE, $currentRelatedDetails['newsdate']), 'NEWS_RELATED_NEWS_TIME' => date(ASCMS_DATE_FORMAT_TIME, $currentRelatedDetails['newsdate']), 'NEWS_RELATED_NEWS_COUNT_COMMENTS' => $currentRelatedDetails['commentactive'] && $this->arrSettings['news_comments_activated'] ? contrexx_raw2xhtml($objSubResult->fields['countComments'] . ' ' . $_ARRAYLANG['TXT_NEWS_COMMENTS']) : ''));
if (!$objSubResult->fields['countComments'] || !$this->arrSettings['news_comments_activated']) {
if ($objTpl->blockExists('related_news_comments_count')) {
$objTpl->hideBlock('related_news_comments_count');
}
}
if ($this->arrSettings['news_use_teaser_text'] != '1' && $objTpl->blockExists('news_use_teaser_text')) {
$objTpl->hideBlock('news_use_teaser_text');
}
$objTpl->parse($blockName);
}
if ($objTpl->blockExists('related_news_block')) {
$objTpl->setVariable('TXT_NEWS_RELATED_NEWS', $_ARRAYLANG['TXT_NEWS_RELATED_NEWS']);
$objTpl->touchBlock('related_news_block');
}
}
}
示例8: access_user
function access_user()
{
$objFWUser = \FWUser::getFWUserObject();
$searchTerm = contrexx_input2raw($_GET['term']);
$userType = contrexx_input2raw($_GET['type']);
$userGroups = 0;
if ($userType == 'newsAuthorName') {
$userGroups = $this->arrSettings['news_assigned_author_groups'];
} elseif ($userType == 'newsPublisherName') {
$userGroups = $this->arrSettings['news_assigned_publisher_groups'];
}
$filter = $userGroups ? array('group_id' => explode(',', $userGroups)) : '';
$objUser = $objFWUser->objUser->getUsers($filter, $searchTerm, null, array());
$i = 0;
$userAttr = array();
while ($objUser && !$objUser->EOF) {
$userName = $objUser->getUsername();
$userId = $objUser->getId();
if ($userName) {
$userAttr[$i]['id'] = $userId;
$userAttr[$i]['label'] = \FWUser::getParsedUserTitle($userId, '', true);
$userAttr[$i]['value'] = \FWUser::getParsedUserTitle($userId);
$i++;
}
$objUser->next();
}
echo json_encode($userAttr);
exit;
}
示例9: showOrders
public function showOrders()
{
global $_ARRAYLANG;
$term = isset($_GET['filter-term']) ? contrexx_input2raw($_GET['filter-term']) : '';
$filterUserId = isset($_GET['filter-user-id']) ? contrexx_input2raw($_GET['filter-user-id']) : 0;
$objFilterUser = null;
if (!empty($term) || !empty($filterUserId)) {
if ($filterUserId) {
$objFilterUser = \FWUser::getFWUserObject()->objUser->getUser($filterUserId);
}
$orders = $this->orderRepository->findOrdersBySearchTerm($term, $objFilterUser);
} else {
$orders = $this->orderRepository->getAllByDesc();
}
$view = new \Cx\Core\Html\Controller\ViewGenerator($orders, array('header' => $_ARRAYLANG['TXT_MODULE_ORDER_ACT_DEFAULT'], 'functions' => array('add' => true, 'edit' => true, 'delete' => true, 'sorting' => true, 'paging' => true, 'filtering' => false), 'fields' => array('contactId' => array('header' => 'contactId', 'table' => array('parse' => function ($value) {
global $_ARRAYLANG;
$userId = \Cx\Modules\Crm\Controller\CrmLibrary::getUserIdByCrmUserId($value);
$userName = \FWUser::getParsedUserTitle($userId);
$crmDetailLink = "<a href='index.php?cmd=Crm&act=customers&tpl=showcustdetail&id={$value}' \n title='{$_ARRAYLANG['TXT_MODULE_ORDER_CRM_CONTACT']}'>\n <img \n src='" . \Env::get('cx')->getCodeBaseCoreWebPath() . "/Core/View/Media/navigation_level_1_189.png' \n width='16' height='16' \n alt='{$_ARRAYLANG['TXT_MODULE_ORDER_CRM_CONTACT']}'\n />\n </a>";
$url = "<a href='index.php?cmd=Access&act=user&tpl=modify&id={$userId}'\n title='{$_ARRAYLANG['TXT_MODULE_ORDER_MODIY_USER_ACCOUNT']}'>" . $userName . "</a>" . $crmDetailLink;
return $url;
})), 'subscriptions' => array('header' => 'subscriptions', 'table' => array('parse' => function ($subscriptions) {
$result = array();
foreach ($subscriptions as $subscription) {
$productEntity = $subscription->getProductEntity();
$productEntityName = $subscription->getProduct()->getName();
if (!$productEntity) {
continue;
}
$productEditLink = $productEntity;
if (method_exists($productEntity, 'getEditLink')) {
$productEditLink = $productEntity->getEditLink();
}
$subscriptionEditUrl = '<a href=index.php?cmd=Order&act=subscription&editid=' . $subscription->getId() . '>' . $productEntityName . '</a>';
$result[] = $subscriptionEditUrl . ' (' . $productEditLink . ')';
}
return implode(', ', $result);
})))));
if (isset($_GET['editid']) && !empty($_GET['editid']) || isset($_GET['add']) && !empty($_GET['add'])) {
$this->template->hideBlock("order_filter");
} else {
\FWUser::getUserLiveSearch(array('minLength' => 1, 'canCancel' => true, 'canClear' => true));
$this->template->setVariable(array('TXT_MODULE_ORDER_SEARCH' => $_ARRAYLANG['TXT_MODULE_ORDER_SEARCH'], 'TXT_MODULE_ORDER_FILTER' => $_ARRAYLANG['TXT_MODULE_ORDER_FILTER'], 'TXT_MODULE_ORDER_SEARCH_TERM' => $_ARRAYLANG['TXT_MODULE_ORDER_SEARCH_TERM'], 'ORDER_SEARCH_VALUE' => isset($_GET['filter-term']) ? contrexx_input2xhtml($_GET['filter-term']) : '', 'ORDER_USER_ID' => contrexx_raw2xhtml($filterUserId), 'ORDER_USER_NAME' => $objFilterUser ? contrexx_raw2xhtml(\FWUser::getParsedUserTitle($objFilterUser)) : ''));
}
$this->template->setVariable('ORDERS_CONTENT', $view->render());
}
示例10: _modifyTask
/**
* add /edit task
*
* @global array $_ARRAYLANG
* @global object $objDatabase
* @return true
*/
public function _modifyTask()
{
global $_ARRAYLANG, $objDatabase, $objJs, $objFWUser;
\JS::registerCSS("modules/Crm/View/Style/contact.css");
if (gettype($objFWUser) === 'NULL') {
$objFWUser = \FWUser::getFWUserObject();
}
$objtpl = $this->_objTpl;
$_SESSION['pageTitle'] = empty($_GET['id']) ? $_ARRAYLANG['TXT_CRM_ADDTASK'] : $_ARRAYLANG['TXT_CRM_EDITTASK'];
$this->_objTpl->loadTemplateFile('module_' . $this->moduleNameLC . '_addtasks.html');
$objtpl->setGlobalVariable("MODULE_NAME", $this->moduleName);
$settings = $this->getSettings();
$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : '';
$date = date('Y-m-d H:i:s');
$title = isset($_POST['taskTitle']) ? contrexx_input2raw($_POST['taskTitle']) : '';
$type = isset($_POST['taskType']) ? (int) $_POST['taskType'] : 0;
$customer = isset($_REQUEST['customerId']) ? (int) $_REQUEST['customerId'] : '';
$duedate = isset($_POST['date']) ? $_POST['date'] : $date;
$assignedto = isset($_POST['assignedto']) ? intval($_POST['assignedto']) : 0;
$description = isset($_POST['description']) ? contrexx_input2raw($_POST['description']) : '';
$notify = isset($_POST['notify']);
$taskId = isset($_REQUEST['searchType']) ? intval($_REQUEST['searchType']) : 0;
$taskTitle = isset($_REQUEST['searchTitle']) ? contrexx_input2raw($_REQUEST['searchTitle']) : '';
$redirect = isset($_REQUEST['redirect']) ? $_REQUEST['redirect'] : base64_encode('&act=task');
// check permission
if (!empty($id)) {
$objResult = $objDatabase->Execute("SELECT `added_by`,\n `assigned_to`\n FROM `" . DBPREFIX . "module_{$this->moduleNameLC}_task`\n WHERE `id` = '{$id}'\n ");
$added_user = (int) $objResult->fields['added_by'];
$assigned_user = (int) $objResult->fields['assigned_to'];
if ($objResult) {
list($task_edit_permission) = $this->getTaskPermission($added_user, $assigned_user);
if (!$task_edit_permission) {
\Permission::noAccess();
}
}
}
if (isset($_POST['addtask'])) {
if (!empty($id)) {
if ($objFWUser->objUser->getAdminStatus() || $added_user == $objFWUser->objUser->getId() || $assigned_user == $assignedto) {
$fields = array('task_title' => $title, 'task_type_id' => $type, 'customer_id' => $customer, 'due_date' => $duedate, 'assigned_to' => $assignedto, 'description' => $description);
$query = \SQL::update("module_{$this->moduleNameLC}_task", $fields, array('escape' => true)) . " WHERE `id` = {$id}";
$_SESSION['strOkMessage'] = $_ARRAYLANG['TXT_CRM_TASK_UPDATE_MESSAGE'];
} else {
$_SESSION['strErrMessage'] = $_ARRAYLANG['TXT_CRM_TASK_RESPONSIBLE_ERR'];
}
} else {
$addedDate = date('Y-m-d H:i:s');
$fields = array('task_title' => $title, 'task_type_id' => $type, 'customer_id' => $customer, 'due_date' => $duedate, 'assigned_to' => $assignedto, 'added_by' => $objFWUser->objUser->getId(), 'added_date_time' => $addedDate, 'task_status' => '0', 'description' => $description);
$query = \SQL::insert("module_{$this->moduleNameLC}_task", $fields, array('escape' => true));
$_SESSION['strOkMessage'] = $_ARRAYLANG['TXT_CRM_TASK_OK_MESSAGE'];
}
$db = $objDatabase->Execute($query);
if ($db) {
if ($notify) {
$cx = \Cx\Core\Core\Controller\Cx::instanciate();
$id = !empty($id) ? $id : $objDatabase->INSERT_ID();
$info['substitution'] = array('CRM_ASSIGNED_USER_NAME' => contrexx_raw2xhtml(\FWUser::getParsedUserTitle($assignedto)), 'CRM_ASSIGNED_USER_EMAIL' => $objFWUser->objUser->getUser($assignedto)->getEmail(), 'CRM_DOMAIN' => ASCMS_PROTOCOL . "://{$_SERVER['HTTP_HOST']}" . $cx->getCodeBaseOffsetPath(), 'CRM_TASK_NAME' => $title, 'CRM_TASK_LINK' => "<a href='" . ASCMS_PROTOCOL . "://{$_SERVER['HTTP_HOST']}" . $cx->getCodeBaseOffsetPath() . $cx->getBackendFolderName() . "/index.php?cmd=" . $this->moduleName . "&act=task&tpl=modify&id={$id}'>{$title}</a>", 'CRM_TASK_URL' => ASCMS_PROTOCOL . "://{$_SERVER['HTTP_HOST']}" . $cx->getCodeBaseOffsetPath() . $cx->getBackendFolderName() . "/index.php?cmd=" . $this->moduleName . "&act=task&tpl=modify&id={$id}", 'CRM_TASK_DUE_DATE' => $duedate, 'CRM_TASK_CREATED_USER' => contrexx_raw2xhtml(\FWUser::getParsedUserTitle($objFWUser->objUser->getId())), 'CRM_TASK_DESCRIPTION_TEXT_VERSION' => contrexx_html2plaintext($description), 'CRM_TASK_DESCRIPTION_HTML_VERSION' => $description);
//setting email template lang id
$availableMailTempLangAry = $this->getActiveEmailTemLangId('Crm', CRM_EVENT_ON_TASK_CREATED);
$availableLangId = $this->getEmailTempLang($availableMailTempLangAry, $objFWUser->objUser->getUser($assignedto)->getEmail());
$info['lang_id'] = $availableLangId;
$dispatcher = CrmEventDispatcher::getInstance();
$dispatcher->triggerEvent(CRM_EVENT_ON_TASK_CREATED, null, $info);
}
\Cx\Core\Csrf\Controller\Csrf::header("Location:./index.php?cmd=" . $this->moduleName . base64_decode($redirect));
exit;
}
} elseif (!empty($id)) {
$objValue = $objDatabase->Execute("SELECT task_id,\n task_title,\n task_type_id,\n due_date,\n assigned_to,\n description,\n c.id,\n c.customer_name,\n c.contact_familyname\n FROM `" . DBPREFIX . "module_{$this->moduleNameLC}_task` AS t\n LEFT JOIN `" . DBPREFIX . "module_{$this->moduleNameLC}_contacts` AS c\n ON t.customer_id = c.id\n WHERE t.id='{$id}'");
$title = $objValue->fields['task_title'];
$type = $objValue->fields['task_type_id'];
$customer = $objValue->fields['id'];
$customerName = !empty($objValue->fields['customer_name']) ? $objValue->fields['customer_name'] . " " . $objValue->fields['contact_familyname'] : '';
$duedate = $objValue->fields['due_date'];
$assignedto = $objValue->fields['assigned_to'];
$description = $objValue->fields['description'];
$taskAutoId = $objValue->fields['task_id'];
}
$this->_getResourceDropDown('Members', $assignedto, $settings['emp_default_user_group']);
$this->taskTypeDropDown($objtpl, $type);
if (!empty($customer)) {
// Get customer Name
$objCustomer = $objDatabase->Execute("SELECT customer_name, contact_familyname FROM `" . DBPREFIX . "module_crm_contacts` WHERE id = {$customer}");
$customerName = $objCustomer->fields['customer_name'] . " " . $objCustomer->fields['contact_familyname'];
}
$objtpl->setVariable(array('CRM_LOGGED_USER_ID' => $objFWUser->objUser->getId(), 'CRM_TASK_AUTOID' => contrexx_raw2xhtml($taskAutoId), 'CRM_TASK_ID' => (int) $id, 'CRM_TASKTITLE' => contrexx_raw2xhtml($title), 'CRM_DUE_DATE' => contrexx_raw2xhtml($duedate), 'CRM_CUSTOMER_ID' => intval($customer), 'CRM_CUSTOMER_NAME' => contrexx_raw2xhtml($customerName), 'CRM_TASK_DESC' => new \Cx\Core\Wysiwyg\Wysiwyg('description', contrexx_raw2xhtml($description)), 'CRM_BACK_LINK' => base64_decode($redirect), 'TXT_CRM_ADD_TASK' => empty($id) ? $_ARRAYLANG['TXT_CRM_ADD_TASK'] : $_ARRAYLANG['TXT_CRM_EDITTASK'], 'TXT_CRM_TASK_ID' => $_ARRAYLANG['TXT_CRM_TASK_ID'], 'TXT_CRM_TASK_TITLE' => $_ARRAYLANG['TXT_CRM_TASK_TITLE'], 'TXT_CRM_TASK_TYPE' => $_ARRAYLANG['TXT_CRM_TASK_TYPE'], 'TXT_CRM_SELECT_TASK_TYPE' => $_ARRAYLANG['TXT_CRM_SELECT_TASK_TYPE'], 'TXT_CRM_CUSTOMER_NAME' => $_ARRAYLANG['TXT_CRM_CUSTOMER_NAME'], 'TXT_CRM_TASK_DUE_DATE' => $_ARRAYLANG['TXT_CRM_TASK_DUE_DATE'], 'TXT_CRM_TASK_RESPONSIBLE' => $_ARRAYLANG['TXT_CRM_TASK_RESPONSIBLE'], 'TXT_CRM_SELECT_MEMBER_NAME' => $_ARRAYLANG['TXT_CRM_SELECT_MEMBER_NAME'], 'TXT_CRM_OVERVIEW' => $_ARRAYLANG['TXT_CRM_OVERVIEW'], 'TXT_CRM_TASK_DESCRIPTION' => $_ARRAYLANG['TXT_CRM_TASK_DESCRIPTION'], 'TXT_CRM_FIND_COMPANY_BY_NAME' => $_ARRAYLANG['TXT_CRM_FIND_COMPANY_BY_NAME'], 'TXT_CRM_SAVE' => $_ARRAYLANG['TXT_CRM_SAVE'], 'TXT_CRM_BACK' => $_ARRAYLANG['TXT_CRM_BACK'], 'TXT_CRM_NOTIFY' => $_ARRAYLANG['TXT_CRM_NOTIFY'], 'TXT_CRM_MANDATORY_FIELDS_NOT_FILLED_OUT' => $_ARRAYLANG['TXT_CRM_MANDATORY_FIELDS_NOT_FILLED_OUT']));
}
示例11: showDetails
/**
* Shows detail-page (content, voting & comments) for a single message. It checks also for new comments (POST) or votings (GET).
*
* @global array
* @global ADONewConnection
* @global array
* @param integer $intMessageId: The details of this page will be shown
*/
function showDetails($intMessageId)
{
global $_CORELANG, $_ARRAYLANG, $objDatabase, $_CONFIG;
$this->initUserId();
$intMessageId = intval($intMessageId);
if ($intMessageId < 1) {
\Cx\Core\Csrf\Controller\Csrf::header("Location: index.php?section=Blog");
}
//Empty form-values
$strName = '';
$strEMail = '';
$strWWW = '';
$strSubject = '';
$strComment = '';
//Check for new votings
if (isset($_POST['vote'])) {
$this->addVoting($intMessageId, $_POST['vote']);
}
//Check for new comments
if (isset($_POST['frmAddComment_MessageId'])) {
$this->addComment();
if (!empty($this->_strErrorMessage) || !\FWUser::getFWUserObject()->objUser->login() && !\Cx\Core_Modules\Captcha\Controller\Captcha::getInstance()->check()) {
//Error occured, get previous entered values
$strName = htmlentities($_POST['frmAddComment_Name'], ENT_QUOTES, CONTREXX_CHARSET);
$strEMail = htmlentities($_POST['frmAddComment_EMail'], ENT_QUOTES, CONTREXX_CHARSET);
$strWWW = htmlentities($_POST['frmAddComment_WWW'], ENT_QUOTES, CONTREXX_CHARSET);
$strSubject = htmlentities($_POST['frmAddComment_Subject'], ENT_QUOTES, CONTREXX_CHARSET);
$strComment = contrexx_stripslashes(html_entity_decode($_POST['frmAddComment_Comment'], ENT_QUOTES, CONTREXX_CHARSET));
}
}
//Count new hit
$this->addHit($intMessageId);
//After processing new actions: show page
$arrEntries = $this->createEntryArray($this->_intLanguageId);
//Loop over socializing-networks
$strNetworks = '';
$arrNetworks = $this->createNetworkArray();
if (count($arrNetworks) > 0) {
$strPageUrl = urlencode(\Cx\Core\Routing\Url::fromModuleAndCmd('Blog', 'details', '', array('id' => $intMessageId))->toString());
foreach ($arrNetworks as $arrNetworkValues) {
if (key_exists($this->_intLanguageId, $arrNetworkValues['status'])) {
$strUrl = str_replace('[URL]', $strPageUrl, $arrNetworkValues['submit']);
$strUrl = str_replace('[SUBJECT]', $arrEntries[$intMessageId]['subject'], $strUrl);
$strNetworks .= '<a href="' . $strUrl . '" title="' . $arrNetworkValues['name'] . ' (' . $arrNetworkValues['www'] . ')" target="_blank">' . $arrNetworkValues['icon_img'] . '</a> ';
}
}
}
//Show message-part
$this->_objTpl->setVariable(array('BLOG_DETAILS_ID' => $intMessageId, 'BLOG_DETAILS_TITLE' => $arrEntries[$intMessageId]['subject'], 'BLOG_DETAILS_POSTED' => $this->getPostedByString($arrEntries[$intMessageId]['user_name'], $arrEntries[$intMessageId]['time_created']), 'BLOG_DETAILS_POSTED_ICON' => $this->getPostedByIcon($arrEntries[$intMessageId]['time_created']), 'BLOG_DETAILS_CONTENT' => html_entity_decode($arrEntries[$intMessageId]['translation'][$this->_intLanguageId]['content']), 'BLOG_DETAILS_IMAGE' => $arrEntries[$intMessageId]['translation'][$this->_intLanguageId]['image'] != '' ? '<img src="' . $arrEntries[$intMessageId]['translation'][$this->_intLanguageId]['image'] . '" title="' . $arrEntries[$intMessageId]['subject'] . '" alt="' . $arrEntries[$intMessageId]['subject'] . '" />' : '', 'BLOG_DETAILS_NETWORKS' => $strNetworks));
//Show voting-part
if ($this->_arrSettings['blog_voting_activated']) {
$this->_objTpl->setVariable(array('TXT_VOTING' => $_ARRAYLANG['TXT_BLOG_FRONTEND_OVERVIEW_VOTING'], 'TXT_VOTING_ACTUAL' => $_ARRAYLANG['TXT_BLOG_FRONTEND_DETAILS_VOTING_ACTUAL'], 'TXT_VOTING_AVG' => $_ARRAYLANG['TXT_BLOG_FRONTEND_DETAILS_VOTING_AVG'], 'TXT_VOTING_COUNT' => $_ARRAYLANG['TXT_BLOG_FRONTEND_DETAILS_VOTING_COUNT'], 'TXT_VOTING_USER' => $_ARRAYLANG['TXT_BLOG_FRONTEND_DETAILS_VOTING_USER']));
$this->_objTpl->setVariable(array('BLOG_DETAILS_VOTING_BAR' => $this->getRatingBar($intMessageId), 'BLOG_DETAILS_VOTING_AVG' => 'Ø ' . $arrEntries[$intMessageId]['votes_avg'], 'BLOG_DETAILS_VOTING_COUNT' => $arrEntries[$intMessageId]['votes'], 'BLOG_DETAILS_VOTING_USER' => $this->hasUserAlreadyVoted($intMessageId) ? $this->getUserVotingForMessage($intMessageId) : $this->getVotingBar($intMessageId)));
} else {
$this->_objTpl->hideBlock('votingPart');
}
//Show comment-part
if ($this->_arrSettings['blog_comments_activated']) {
//comments are activated
$this->_objTpl->setVariable(array('TXT_COMMENTS' => $_ARRAYLANG['TXT_BLOG_FRONTEND_OVERVIEW_COMMENTS'], 'TXT_COMMENT_ADD' => $_ARRAYLANG['TXT_BLOG_FRONTEND_DETAILS_COMMENT_ADD'], 'TXT_COMMENT_ADD_NAME' => $_ARRAYLANG['TXT_BLOG_FRONTEND_DETAILS_COMMENT_ADD_NAME'], 'TXT_COMMENT_ADD_EMAIL' => $_ARRAYLANG['TXT_BLOG_FRONTEND_DETAILS_COMMENT_ADD_EMAIL'], 'TXT_COMMENT_ADD_WWW' => $_ARRAYLANG['TXT_BLOG_FRONTEND_DETAILS_COMMENT_ADD_WWW'], 'TXT_COMMENT_ADD_SUBJECT' => $_ARRAYLANG['TXT_BLOG_FRONTEND_DETAILS_COMMENT_ADD_SUBJECT'], 'TXT_COMMENT_ADD_COMMENT' => $_ARRAYLANG['TXT_BLOG_FRONTEND_DETAILS_COMMENT_ADD_COMMENT'], 'TXT_COMMENT_ADD_RESET' => $_ARRAYLANG['TXT_BLOG_FRONTEND_DETAILS_COMMENT_ADD_RESET'], 'TXT_COMMENT_ADD_SUBMIT' => $_ARRAYLANG['TXT_BLOG_FRONTEND_DETAILS_COMMENT_ADD_SUBMIT']));
if (\FWUser::getFWUserObject()->objUser->login()) {
$this->_objTpl->hideBlock('comment_captcha');
} else {
$this->_objTpl->setVariable(array('TXT_COMMENT_CAPTCHA' => $_CORELANG['TXT_CORE_CAPTCHA'], 'COMMENT_CAPTCHA_CODE' => \Cx\Core_Modules\Captcha\Controller\Captcha::getInstance()->getCode()));
$this->_objTpl->parse('comment_captcha');
}
$this->_objTpl->setVariable(array('BLOG_DETAILS_COMMENTS_JAVASCRIPT' => $this->getJavascript('comments')));
$objFWUser = \FWUser::getFWUserObject();
$objCommentsResult = $objDatabase->Execute('SELECT comment_id,
time_created,
user_id,
user_name,
user_mail,
user_www,
subject,
comment
FROM ' . DBPREFIX . 'module_blog_comments
WHERE message_id=' . $intMessageId . ' AND
lang_id=' . $this->_intLanguageId . ' AND
is_active="1"
ORDER BY time_created ASC, comment_id ASC
');
if ($objCommentsResult->RecordCount() > 0) {
while (!$objCommentsResult->EOF) {
//Get username and avatar
$strUserName = '';
$strUserAvatar = '<img src="' . ASCMS_BLOG_IMAGES_WEB_PATH . '/no_avatar.gif" alt="' . $strUserName . '" />';
$objUser = $objFWUser->objUser->getUser($objCommentsResult->fields['user_id']);
if ($objCommentsResult->fields['user_id'] == 0 || $objUser === false) {
$strUserName = $objCommentsResult->fields['user_name'];
} else {
$strUserName = contrexx_raw2xhtml(\FWUser::getParsedUserTitle($objUser));
//.........这里部分代码省略.........
示例12: showOrders
public function showOrders()
{
global $_ARRAYLANG;
$term = isset($_GET['filter-term']) ? contrexx_input2raw($_GET['filter-term']) : '';
$filterUserId = isset($_GET['filter-user-id']) ? contrexx_input2raw($_GET['filter-user-id']) : 0;
$objFilterUser = null;
if (!empty($term) || !empty($filterUserId)) {
if ($filterUserId) {
$objFilterUser = \FWUser::getFWUserObject()->objUser->getUser($filterUserId);
}
$orders = $this->orderRepository->findOrdersBySearchTerm($term, $objFilterUser);
} else {
$orders = $this->orderRepository->getAllByDesc();
}
$orders = new \Cx\Core_Modules\Listing\Model\Entity\DataSet($orders);
// setDataType is used to make the ViewGenerator load the proper options if $orders is empty
$orders->setDataType('Cx\\Modules\\Order\\Model\\Entity\\Order');
$options = $this->getController('Backend')->getAllViewGeneratorOptions();
$view = new \Cx\Core\Html\Controller\ViewGenerator($orders, $options);
if (isset($_GET['editid']) && !empty($_GET['editid']) || isset($_GET['add']) && !empty($_GET['add'])) {
$this->template->hideBlock("order_filter");
} else {
\FWUser::getUserLiveSearch(array('minLength' => 1, 'canCancel' => true, 'canClear' => true));
$this->template->setVariable(array('TXT_MODULE_ORDER_SEARCH' => $_ARRAYLANG['TXT_MODULE_ORDER_SEARCH'], 'TXT_MODULE_ORDER_FILTER' => $_ARRAYLANG['TXT_MODULE_ORDER_FILTER'], 'TXT_MODULE_ORDER_SEARCH_TERM' => $_ARRAYLANG['TXT_MODULE_ORDER_SEARCH_TERM'], 'ORDER_SEARCH_VALUE' => isset($_GET['filter-term']) ? contrexx_input2xhtml($_GET['filter-term']) : '', 'ORDER_USER_ID' => contrexx_raw2xhtml($filterUserId), 'ORDER_USER_NAME' => $objFilterUser ? contrexx_raw2xhtml(\FWUser::getParsedUserTitle($objFilterUser)) : ''));
}
$this->template->setVariable('ORDERS_CONTENT', $view->render());
}