当前位置: 首页>>代码示例>>PHP>>正文


PHP VTCacheUtils类代码示例

本文整理汇总了PHP中VTCacheUtils的典型用法代码示例。如果您正苦于以下问题:PHP VTCacheUtils类的具体用法?PHP VTCacheUtils怎么用?PHP VTCacheUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了VTCacheUtils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getReportScheduleInfo

 public function getReportScheduleInfo()
 {
     $adb = PearDatabase::getInstance();
     if (!empty($this->id)) {
         $cachedInfo = VTCacheUtils::lookupReport_ScheduledInfo($this->user->id, $this->id);
         if ($cachedInfo == false) {
             $result = $adb->pquery('SELECT * FROM  its4you_reports4you_scheduled_reports WHERE reportid=?', array($this->id));
             if ($adb->num_rows($result) > 0) {
                 $reportScheduleInfo = $adb->raw_query_result_rowdata($result, 0);
                 $scheduledInterval = !empty($reportScheduleInfo['schedule']) ? Zend_Json::decode($reportScheduleInfo['schedule']) : array();
                 $scheduledRecipients = !empty($reportScheduleInfo['recipients']) ? Zend_Json::decode($reportScheduleInfo['recipients']) : array();
                 VTCacheUtils::updateReport_ScheduledInfo($this->user->id, $this->id, true, $reportScheduleInfo['format'], $scheduledInterval, $scheduledRecipients, $reportScheduleInfo['next_trigger_time']);
                 $cachedInfo = VTCacheUtils::lookupReport_ScheduledInfo($this->user->id, $this->id);
             }
         }
         if ($cachedInfo) {
             $this->isScheduled = $cachedInfo['isScheduled'];
             $this->scheduledFormat = $cachedInfo['scheduledFormat'];
             $this->scheduledInterval = $cachedInfo['scheduledInterval'];
             $this->scheduledRecipients = $cachedInfo['scheduledRecipients'];
             $this->scheduledTime = $cachedInfo['scheduledTime'];
             return true;
         }
     } else {
         $this->isScheduled = isset($_REQUEST['isReportScheduled']) && $_REQUEST['isReportScheduled'] != '' ? $_REQUEST['isReportScheduled'] : '';
         $this->scheduledFormat = isset($_REQUEST['scheduledReportFormat']) && $_REQUEST['scheduledReportFormat'] != '' ? $_REQUEST['scheduledReportFormat'] : '';
         $this->scheduledInterval = isset($_REQUEST['scheduledTypeSelectedStr']) && $_REQUEST['scheduledTypeSelectedStr'] != '' ? Zend_Json::decode($_REQUEST['scheduledIntervalJson']) : array();
         $this->scheduledRecipients = isset($_REQUEST['selectedRecipientsStr']) && $_REQUEST['selectedRecipientsStr'] != '' ? Zend_Json::decode($_REQUEST['selectedRecipientsStr']) : array();
         return true;
     }
     // ITS4YOU-END
     return false;
 }
开发者ID:cin-system,项目名称:cinrepo,代码行数:33,代码来源:ScheduledReports4You.php

示例2: Reports

 function Reports($reportId = "")
 {
     $db = PearDatabase::getInstance();
     $currentUser = Users_Record_Model::getCurrentUserModel();
     $userId = $currentUser->getId();
     $this->initListOfModules();
     if ($reportId != "") {
         // Lookup information in cache first
         $cachedInfo = VTCacheUtils::lookupReport_Info($userId, $reportId);
         $subOrdinateUsers = VTCacheUtils::lookupReport_SubordinateUsers($reportId);
         if ($cachedInfo === false) {
             $ssql = "SELECT vtiger_reportmodules.*, vtiger_report.* FROM vtiger_report\n\t\t\t\t\t\t\tINNER JOIN vtiger_reportmodules ON vtiger_report.reportid = vtiger_reportmodules.reportmodulesid\n\t\t\t\t\t\t\tWHERE vtiger_report.reportid = ?";
             $params = array($reportId);
             require_once 'include/utils/GetUserGroups.php';
             require 'user_privileges/user_privileges_' . $userId . '.php';
             $userGroups = new GetUserGroups();
             $userGroups->getAllUserGroups($userId);
             $userGroupsList = $userGroups->user_groups;
             if (!empty($userGroupsList) && $currentUser->isAdminUser() == false) {
                 $userGroupsQuery = " (shareid IN (" . generateQuestionMarks($userGroupsList) . ") AND setype='groups') OR";
                 array_push($params, $userGroupsList);
             }
             $nonAdminQuery = " vtiger_report.reportid IN (SELECT reportid from vtiger_reportsharing\n\t\t\t\t\t\t\t\t\tWHERE {$userGroupsQuery} (shareid=? AND setype='users'))";
             if ($currentUser->isAdminUser() == false) {
                 $ssql .= " AND (({$nonAdminQuery})\n\t\t\t\t\t\t\t\tOR vtiger_report.sharingtype = 'Public'\n\t\t\t\t\t\t\t\tOR vtiger_report.owner = ? OR vtiger_report.owner IN\n\t\t\t\t\t\t\t\t\t(SELECT vtiger_user2role.userid FROM vtiger_user2role\n\t\t\t\t\t\t\t\t\tINNER JOIN vtiger_users ON vtiger_users.id = vtiger_user2role.userid\n\t\t\t\t\t\t\t\t\tINNER JOIN vtiger_role ON vtiger_role.roleid = vtiger_user2role.roleid\n\t\t\t\t\t\t\t\t\tWHERE vtiger_role.parentrole LIKE '{$current_user_parent_role_seq}::%')\n\t\t\t\t\t\t\t\t)";
                 array_push($params, $userId, $userId);
             }
             $result = $db->pquery($ssql, $params);
             if ($result && $db->num_rows($result)) {
                 $reportModulesRow = $db->fetch_array($result);
                 // Update information in cache now
                 VTCacheUtils::updateReport_Info($userId, $reportId, $reportModulesRow["primarymodule"], $reportModulesRow["secondarymodules"], $reportModulesRow["reporttype"], $reportModulesRow["reportname"], $reportModulesRow["description"], $reportModulesRow["folderid"], $reportModulesRow["owner"]);
             }
             $subOrdinateUsers = array();
             $subResult = $db->pquery("SELECT userid FROM vtiger_user2role\n\t\t\t\t\t\t\t\t\tINNER JOIN vtiger_users ON vtiger_users.id = vtiger_user2role.userid\n\t\t\t\t\t\t\t\t\tINNER JOIN vtiger_role ON vtiger_role.roleid = vtiger_user2role.roleid\n\t\t\t\t\t\t\t\t\tWHERE vtiger_role.parentrole LIKE '{$current_user_parent_role_seq}::%'", array());
             $numOfSubRows = $db->num_rows($subResult);
             for ($i = 0; $i < $numOfSubRows; $i++) {
                 $subOrdinateUsers[] = $db->query_result($subResult, $i, 'userid');
             }
             // Update subordinate user information for re-use
             VTCacheUtils::updateReport_SubordinateUsers($reportId, $subOrdinateUsers);
             // Re-look at cache to maintain code-consistency below
             $cachedInfo = VTCacheUtils::lookupReport_Info($userId, $reportId);
         }
         if ($cachedInfo) {
             $this->primodule = $cachedInfo["primarymodule"];
             $this->secmodule = $cachedInfo["secondarymodules"];
             $this->reporttype = $cachedInfo["reporttype"];
             $this->reportname = decode_html($cachedInfo["reportname"]);
             $this->reportdescription = decode_html($cachedInfo["description"]);
             $this->folderid = $cachedInfo["folderid"];
             if ($currentUser->isAdminUser() == true || in_array($cachedInfo["owner"], $subOrdinateUsers) || $cachedInfo["owner"] == $userId) {
                 $this->is_editable = true;
             } else {
                 $this->is_editable = false;
             }
         }
     }
     return $this;
 }
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:60,代码来源:Report.php

示例3: getFieldByReportLabel

/**
 * Function to get the field information from module name and field label
 */
function getFieldByReportLabel($module, $label)
{
    // this is required so the internal cache is populated or reused.
    getColumnFields($module);
    //lookup all the accessible fields
    $cachedModuleFields = VTCacheUtils::lookupFieldInfo_Module($module);
    if ($module == 'Calendar') {
        $cachedEventsFields = VTCacheUtils::lookupFieldInfo_Module('Events');
        if ($cachedModuleFields == false) {
            $cachedModuleFields = $cachedEventsFields;
        } else {
            $cachedModuleFields = array_merge($cachedModuleFields, $cachedEventsFields);
        }
    }
    if (empty($cachedModuleFields)) {
        return null;
    }
    $label = decode_html($label);
    foreach ($cachedModuleFields as $fieldInfo) {
        $fieldLabel = str_replace(' ', '_', $fieldInfo['fieldlabel']);
        if ($label == $fieldLabel) {
            return $fieldInfo;
        }
    }
    return null;
}
开发者ID:kduqi,项目名称:corebos,代码行数:29,代码来源:ReportUtils.php

示例4: getReportScheduleInfo

 public function getReportScheduleInfo()
 {
     $adb = PearDatabase::getInstance();
     if (!empty($this->id)) {
         $cachedInfo = VTCacheUtils::lookupReport_ScheduledInfo($this->user->id, $this->id);
         if ($cachedInfo == false) {
             $result = $adb->pquery('SELECT * FROM vtiger_scheduled_reports WHERE reportid=?', array($this->id));
             if ($adb->num_rows($result) > 0) {
                 $reportScheduleInfo = $adb->raw_query_result_rowdata($result, 0);
                 $scheduledInterval = !empty($reportScheduleInfo['schedule']) ? Zend_Json::decode($reportScheduleInfo['schedule']) : array();
                 $scheduledRecipients = !empty($reportScheduleInfo['recipients']) ? Zend_Json::decode($reportScheduleInfo['recipients']) : array();
                 VTCacheUtils::updateReport_ScheduledInfo($this->user->id, $this->id, true, $reportScheduleInfo['format'], $scheduledInterval, $scheduledRecipients, $reportScheduleInfo['next_trigger_time']);
                 $cachedInfo = VTCacheUtils::lookupReport_ScheduledInfo($this->user->id, $this->id);
             }
         }
         if ($cachedInfo) {
             $this->isScheduled = $cachedInfo['isScheduled'];
             $this->scheduledFormat = $cachedInfo['scheduledFormat'];
             $this->scheduledInterval = $cachedInfo['scheduledInterval'];
             $this->scheduledRecipients = $cachedInfo['scheduledRecipients'];
             $this->scheduledTime = $cachedInfo['scheduledTime'];
             return true;
         }
     }
     return false;
 }
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:26,代码来源:ScheduledReports.php

示例5: getFieldByReportLabel

/**
 * Function to get the field information from module name and field label
 */
function getFieldByReportLabel($module, $label)
{
    // this is required so the internal cache is populated or reused.
    getColumnFields($module);
    //lookup all the accessible fields
    $cachedModuleFields = VTCacheUtils::lookupFieldInfo_Module($module);
    if (empty($cachedModuleFields)) {
        return null;
    }
    foreach ($cachedModuleFields as $fieldInfo) {
        $fieldLabel = str_replace(' ', '_', $fieldInfo['fieldlabel']);
        if ($label == $fieldLabel) {
            return $fieldInfo;
        }
    }
    return null;
}
开发者ID:mslokhat,项目名称:corebos,代码行数:20,代码来源:ReportUtils.php

示例6: getFieldByReportLabel

/**
 * Function to get the field information from module name and field label
 */
function getFieldByReportLabel($module, $label)
{
    $cacheLabel = VTCacheUtils::getReportFieldByLabel($module, $label);
    if ($cacheLabel) {
        return $cacheLabel;
    }
    // this is required so the internal cache is populated or reused.
    getColumnFields($module);
    //lookup all the accessible fields
    $cachedModuleFields = VTCacheUtils::lookupFieldInfo_Module($module);
    $label = decode_html($label);
    if ($module == 'Calendar') {
        $cachedEventsFields = VTCacheUtils::lookupFieldInfo_Module('Events');
        if ($cachedEventsFields) {
            if (empty($cachedModuleFields)) {
                $cachedModuleFields = $cachedEventsFields;
            } else {
                $cachedModuleFields = array_merge($cachedModuleFields, $cachedEventsFields);
            }
        }
        if ($label == 'Start_Date_and_Time') {
            $label = 'Start_Date_&_Time';
        }
    }
    if (empty($cachedModuleFields)) {
        return null;
    }
    foreach ($cachedModuleFields as $fieldInfo) {
        $fieldLabel = str_replace(' ', '_', $fieldInfo['fieldlabel']);
        $fieldLabel = decode_html($fieldLabel);
        //SalesPlatform.ru begin fix get field info by label
        if ($label == $fieldLabel || $label == getTranslatedString($fieldLabel, $module)) {
            //if($label == $fieldLabel) {
            //SalesPlatform.ru end
            VTCacheUtils::setReportFieldByLabel($module, $label, $fieldInfo);
            return $fieldInfo;
        }
    }
    return null;
}
开发者ID:gitter-badger,项目名称:openshift-salesplatform,代码行数:43,代码来源:ReportUtils.php

示例7: getModuleSequenceField

function getModuleSequenceField($module)
{
    global $adb, $log;
    $log->debug("Entering function getModuleSequenceFieldName ({$module})...");
    $field = null;
    if (!empty($module)) {
        // First look at the cached information
        $cachedModuleFields = VTCacheUtils::lookupFieldInfo_Module($module);
        if ($cachedModuleFields === false) {
            //uitype 4 points to Module Numbering Field
            $seqColRes = $adb->pquery("SELECT fieldname, fieldlabel, columnname FROM vtiger_field WHERE uitype=? AND tabid=? and vtiger_field.presence in (0,2)", array('4', getTabid($module)));
            if ($adb->num_rows($seqColRes) > 0) {
                $fieldname = $adb->query_result($seqColRes, 0, 'fieldname');
                $columnname = $adb->query_result($seqColRes, 0, 'columnname');
                $fieldlabel = $adb->query_result($seqColRes, 0, 'fieldlabel');
                $field = array();
                $field['name'] = $fieldname;
                $field['column'] = $columnname;
                $field['label'] = $fieldlabel;
            }
        } else {
            foreach ($cachedModuleFields as $fieldinfo) {
                if ($fieldinfo['uitype'] == '4') {
                    $field = array();
                    $field['name'] = $fieldinfo['fieldname'];
                    $field['column'] = $fieldinfo['columnname'];
                    $field['label'] = $fieldinfo['fieldlabel'];
                    break;
                }
            }
        }
    }
    $log->debug("Exiting getModuleSequenceFieldName...");
    return $field;
}
开发者ID:jgjermeni,项目名称:corebos,代码行数:35,代码来源:utils.php

示例8: getFieldByPDFMakerLabel

 function getFieldByPDFMakerLabel($module, $label)
 {
     $cacheLabel = VTCacheUtils::getReportFieldByLabel($module, $label);
     if ($cacheLabel) {
         return $cacheLabel;
     }
     // this is required so the internal cache is populated or reused.
     getColumnFields($module);
     //lookup all the accessible fields
     $cachedModuleFields = VTCacheUtils::lookupFieldInfo_Module($module);
     if (empty($cachedModuleFields)) {
         return null;
     }
     foreach ($cachedModuleFields as $fieldInfo) {
         $fieldName = str_replace(' ', '_', $fieldInfo['fieldname']);
         if ($label == $fieldName) {
             VTCacheUtils::setReportFieldByLabel($module, $label, $fieldInfo);
             return $fieldInfo;
         }
     }
     return null;
 }
开发者ID:cin-system,项目名称:cinrepo,代码行数:22,代码来源:RelBlockRun.php

示例9: setMailerProperties

/**	Function to set all the Mailer properties
  *	$mail 		-- reference of the mail object
  *	$subject	-- subject of the email you want to send
  *	$contents	-- body of the email you want to send
  *	$from_email	-- from email id which will be displayed in the mail
  *	$from_name	-- from name which will be displayed in the mail
  *	$to_email 	-- to email address  -- This can be an email in a single string, a comma separated
  *			   list of emails or an array of email addresses
  *	$attachment	-- whether we want to attach the currently selected file or all vtiger_files.
  				[values = current,all] - optional
  *	$emailid	-- id of the email object which will be used to get the vtiger_attachments - optional
  */
function setMailerProperties($mail, $subject, $contents, $from_email, $from_name, $to_email, $attachment = '', $emailid = '', $module = '', $logo = '')
{
    $adb = PearDatabase::getInstance();
    $adb->println("Inside the function setMailerProperties");
    $CompanyDetails = getCompanyDetails();
    $logourl = 'storage/Logo/' . $CompanyDetails['logoname'];
    if ($logo == 1) {
        $image = getimagesize($logourl);
        $mail->AddEmbeddedImage($logourl, 'logo', $CompanyDetails['logoname'], "base64", $image['mime']);
    }
    $mail->Subject = $subject;
    //Added back as we have changed php mailer library, older library was using html_entity_decode before sending mail
    $mail->Body = decode_html($contents);
    //$mail->Body = html_entity_decode(nl2br($contents));	//if we get html tags in mail then we will use this line
    $mail->AltBody = strip_tags(preg_replace(array("/<p>/i", "/<br>/i", "/<br \\/>/i"), array("\n", "\n", "\n"), $contents));
    $mail->IsSMTP();
    //set mailer to use SMTP
    //$mail->Host = "smtp1.example.com;smtp2.example.com";  // specify main and backup server
    setMailServerProperties($mail);
    //Handle the from name and email for HelpDesk
    $mail->From = $from_email;
    $userFullName = trim(VTCacheUtils::getUserFullName($from_name));
    if (empty($userFullName)) {
        $rs = $adb->pquery("select first_name,last_name from vtiger_users where user_name=?", array($from_name));
        $num_rows = $adb->num_rows($rs);
        if ($num_rows > 0) {
            $fullName = getFullNameFromQResult($rs, 0, 'Users');
            VTCacheUtils::setUserFullName($from_name, $fullName);
        }
    } else {
        $from_name = $userFullName;
    }
    $mail->FromName = decode_html($from_name);
    if ($to_email != '') {
        if (is_array($to_email)) {
            for ($j = 0, $num = count($to_email); $j < $num; $j++) {
                $mail->addAddress($to_email[$j]);
            }
        } else {
            $_tmp = explode(",", $to_email);
            for ($j = 0, $num = count($_tmp); $j < $num; $j++) {
                $mail->addAddress($_tmp[$j]);
            }
        }
    }
    //commented so that it does not add from_email in reply to
    //$mail->AddReplyTo($from_email);
    $mail->WordWrap = 50;
    //If we want to add the currently selected file only then we will use the following function
    if ($attachment == 'current' && $emailid != '') {
        if (isset($_REQUEST['filename_hidden'])) {
            $file_name = $_REQUEST['filename_hidden'];
        } else {
            $file_name = $_FILES['filename']['name'];
        }
        addAttachment($mail, $file_name, $emailid);
    }
    //This will add all the vtiger_files which are related to this record or email
    if ($attachment == 'all' && $emailid != '') {
        addAllAttachments($mail, $emailid);
    }
    $mail->IsHTML(true);
    // set email format to HTML
    return;
}
开发者ID:rcrrich,项目名称:UpdatePackages,代码行数:77,代码来源:mail.php

示例10: getCurrencyInfo

function getCurrencyInfo($currencyid)
{
    $currencyinfo = VTCacheUtils::lookupCurrencyInfo($currencyid);
    if ($currencyinfo === false) {
        global $adb;
        $sql1 = "select * from vtiger_currency_info where id= ?";
        $result = $adb->pquery($sql1, array($currencyid));
        $resultinfo = $adb->fetch_array($result);
        // Update cache
        VTCacheUtils::updateCurrencyInfo($currencyid, $resultinfo['currency_name'], $resultinfo['currency_code'], $resultinfo['currency_symbol'], $resultinfo['conversion_rate']);
        // Re-look at the cache now
        $currencyinfo = VTCacheUtils::lookupCurrencyInfo($currencyid);
    }
    return $currencyinfo;
}
开发者ID:Wasage,项目名称:werpa,代码行数:15,代码来源:CommonUtils.php

示例11: buildSearchQueryWithUIType

 public function buildSearchQueryWithUIType($uitype, $value, $module)
 {
     if (empty($value)) {
         return false;
     }
     $cachedModuleFields = VTCacheUtils::lookupFieldInfo_Module($module);
     if ($cachedModuleFields === false) {
         getColumnFields($module);
         // This API will initialize the cache as well
         // We will succeed now due to above function call
         $cachedModuleFields = VTCacheUtils::lookupFieldInfo_Module($module);
     }
     $lookuptables = array();
     $lookupcolumns = array();
     foreach ($cachedModuleFields as $fieldinfo) {
         if (in_array($fieldinfo['uitype'], array($uitype))) {
             $lookuptables[] = $fieldinfo['tablename'];
             $lookupcolumns[] = $fieldinfo['columnname'];
         }
     }
     $entityfields = getEntityField($module);
     $querycolumnnames = implode(',', $lookupcolumns);
     $entitycolumnnames = $entityfields['fieldname'];
     $query = "select id as id, {$querycolumnnames}, {$entitycolumnnames} as name ";
     $query .= " FROM vtiger_users";
     if (!empty($lookupcolumns)) {
         $query .= " WHERE deleted=0 AND ";
         $i = 0;
         $columnCount = count($lookupcolumns);
         foreach ($lookupcolumns as $columnname) {
             if (!empty($columnname)) {
                 if ($i == 0 || $i == $columnCount) {
                     $query .= sprintf("%s = '%s'", $columnname, $value);
                 } else {
                     $query .= sprintf(" OR %s = '%s'", $columnname, $value);
                 }
                 $i++;
             }
         }
     }
     return $query;
 }
开发者ID:cannking,项目名称:vtigercrm-debug,代码行数:42,代码来源:Record.php

示例12: delete

 public function delete($role)
 {
     $db = PearDatabase::getInstance();
     $db->dieOnError = true;
     $sql = "update vtiger_user2role set roleid=? where roleid=?";
     $db->pquery($sql, array($role->getId(), $this->getId()));
     //Deleteing from vtiger_role2profile vtiger_table
     $sql = "delete from vtiger_role2profile where roleid=?";
     $db->pquery($sql, array($this->getId()));
     //delete handling for vtiger_groups
     $sql = "delete from vtiger_group2role where roleid=?";
     $db->pquery($sql, array($this->getId()));
     $sql = "delete from vtiger_group2rs where roleandsubid=?";
     $db->pquery($sql, array($this->getId()));
     //delete handling for sharing rules
     deleteRoleRelatedSharingRules($this->getId());
     //delete from vtiger_role vtiger_table;
     $sql = "delete from vtiger_role where roleid=?";
     $db->pquery($sql, array($this->getId()));
     $targetParentRoleSequence = $role->getParentRole();
     $parentRoleSequence = $this->getParentRole();
     $roleInfoList = getRoleAndSubordinatesInformation($roleId);
     foreach ($roleInfoList as $roleId => $roleInfo) {
         // Invalidate any cached information
         VTCacheUtils::clearRoleSubordinates($roleId);
         if ($roleId == $this->getId()) {
             continue;
         }
         $currentParentRoleSequence = $roleInfo[1];
         $currentParentRoleSequence = str_replace($parentRoleSequence, $targetParentRoleSequence, $currentParentRoleSequence);
         $subDepth = count(explode('::', $currentParentRoleSequence)) - 1;
         $query = "update vtiger_role set parentrole=?,depth=? where roleid=?";
         $db->pquery($query, array($currentParentRoleSequence, $subDepth, $roleId));
     }
 }
开发者ID:sacredwebsite,项目名称:vtigercrm,代码行数:35,代码来源:Role.php

示例13: GetRelatedListBase


//.........这里部分代码省略.........
            $_SESSION['rlvs'][$module][$relatedmodule]['sorder'] = $sorder;
            $_SESSION['rlvs'][$module][$relatedmodule]['sortby'] = $order_by;
        }
    } elseif ($_SESSION['rlvs'][$module][$relatedmodule]) {
        $sorder = $_SESSION['rlvs'][$module][$relatedmodule]['sorder'];
        $order_by = $_SESSION['rlvs'][$module][$relatedmodule]['sortby'];
    } else {
        $order_by = $focus->default_order_by;
        $sorder = $focus->default_sort_order;
    }
    // AssignedTo ordering issue in Related Lists
    $query_order_by = $order_by;
    if ($order_by == 'smownerid') {
        $userNameSql = getSqlForNameInDisplayFormat(array('first_name' => 'vtiger_users.first_name', 'last_name' => 'vtiger_users.last_name'), 'Users');
        $query_order_by = "case when (vtiger_users.user_name not like '') then {$userNameSql} else vtiger_groups.groupname end ";
    } elseif ($order_by != 'crmid' && !empty($order_by)) {
        $tabname = getTableNameForField($relatedmodule, $order_by);
        if ($tabname !== '' and $tabname != NULL) {
            $query_order_by = $tabname . "." . $query_order_by;
        }
    }
    if (!empty($query_order_by)) {
        $query .= ' ORDER BY ' . $query_order_by . ' ' . $sorder;
    }
    if ($relatedmodule == 'Calendar') {
        $mod_listquery = "activity_listquery";
    } else {
        $mod_listquery = strtolower($relatedmodule) . "_listquery";
    }
    $_SESSION[$mod_listquery] = $query;
    $url_qry = "&order_by=" . $order_by . "&sorder=" . $sorder;
    $computeCount = isset($_REQUEST['withCount']) ? $_REQUEST['withCount'] : '';
    if (PerformancePrefs::getBoolean('LISTVIEW_COMPUTE_PAGE_COUNT', false) === true || (bool) $computeCount == true) {
        // Retreiving the no of rows
        list($specialPermissionWithDuplicateRows, $cached) = VTCacheUtils::lookupCachedInformation('SpecialPermissionWithDuplicateRows');
        if (FALSE and ($specialPermissionWithDuplicateRows or $relatedmodule == 'Calendar')) {
            // FIXME FIXME FIXME FIXME
            // the FALSE above MUST be eliminated, we need to execute mkCountWithFullQuery for modified queries
            // the problem is that related list queries are hardcoded and can (mostly do) repeat columns which is not supported as a
            // subquery which is what mkCountWithFullQuery does
            // This works on ListView because we use query generator that eliminates those repeated columns
            // It is currently incorrect and will produce wrong count on related lists when special permissions are active
            // FIXME FIXME FIXME FIXME
            // for calendar (with multiple contacts for single activity) and special permissions, count will change
            $count_result = $adb->query(mkCountWithFullQuery($query));
        } else {
            $count_result = $adb->query(mkCountQuery($query));
        }
        $noofrows = $adb->query_result($count_result, 0, 'count');
    } else {
        $noofrows = null;
    }
    //Setting Listview session object while sorting/pagination
    if (isset($_REQUEST['relmodule']) && $_REQUEST['relmodule'] != '' && $_REQUEST['relmodule'] == $relatedmodule) {
        $relmodule = vtlib_purify($_REQUEST['relmodule']);
        if ($_SESSION['rlvs'][$module][$relmodule]) {
            setSessionVar($_SESSION['rlvs'][$module][$relmodule], $noofrows, $list_max_entries_per_page, $module, $relmodule);
        }
    }
    global $relationId;
    $start = RelatedListViewSession::getRequestCurrentPage($relationId, $query);
    $navigation_array = VT_getSimpleNavigationValues($start, $list_max_entries_per_page, $noofrows);
    $limit_start_rec = ($start - 1) * $list_max_entries_per_page;
    $list_result = $adb->pquery($query . " LIMIT {$limit_start_rec}, {$list_max_entries_per_page}", array());
    /* Save the related list in session for when we click in a register
     * from this list we will can navigate with the arrows left and right, to move only in this related list
     */
    $relcv = new CustomView();
    $relviewId = $relcv->getViewId($relatedmodule);
    ListViewSession::setSessionQuery($relatedmodule, $query, $relviewId);
    $_SESSION['lvs'][$relatedmodule][$relviewId]['start'] = $start;
    //Retreive the List View Table Header
    $id = vtlib_purify($_REQUEST['record']);
    $listview_header = getListViewHeader($focus, $relatedmodule, '', $sorder, $order_by, $id, '', $module, $skipActions);
    //"Accounts");
    if ($noofrows > 15) {
        $smarty->assign('SCROLLSTART', '<div style="overflow:auto;height:315px;width:100%;">');
        $smarty->assign('SCROLLSTOP', '</div>');
    }
    $smarty->assign("LISTHEADER", $listview_header);
    if ($module == 'PriceBook' && $relatedmodule == 'Products') {
        $listview_entries = getListViewEntries($focus, $relatedmodule, $list_result, $navigation_array, 'relatedlist', $returnset, $edit_val, $del_val, '', '', '', '', $skipActions);
    }
    if ($module == 'Products' && $relatedmodule == 'PriceBooks') {
        $listview_entries = getListViewEntries($focus, $relatedmodule, $list_result, $navigation_array, 'relatedlist', $returnset, 'EditListPrice', 'DeletePriceBookProductRel', '', '', '', '', $skipActions);
    } elseif ($relatedmodule == 'SalesOrder') {
        $listview_entries = getListViewEntries($focus, $relatedmodule, $list_result, $navigation_array, 'relatedlist', $returnset, 'SalesOrderEditView', 'DeleteSalesOrder', '', '', '', '', $skipActions);
    } else {
        $listview_entries = getListViewEntries($focus, $relatedmodule, $list_result, $navigation_array, 'relatedlist', $returnset, $edit_val, $del_val, '', '', '', '', $skipActions);
    }
    $navigationOutput = array();
    $navigationOutput[] = getRecordRangeMessage($list_result, $limit_start_rec, $noofrows);
    if (empty($id) && !empty($_REQUEST['record'])) {
        $id = vtlib_purify($_REQUEST['record']);
    }
    $navigationOutput[] = getRelatedTableHeaderNavigation($navigation_array, $url_qry, $module, $relatedmodule, $id);
    $related_entries = array('header' => $listview_header, 'entries' => $listview_entries, 'navigation' => $navigationOutput);
    $log->debug("Exiting GetRelatedList method ...");
    return $related_entries;
}
开发者ID:kduqi,项目名称:corebos,代码行数:101,代码来源:RelatedListView.php

示例14: getCurrencySymbolandCRate

/** This function returns the conversion rate and vtiger_currency symbol
 * in array format for a given id.
 * param $id - vtiger_currency id.
 */
function getCurrencySymbolandCRate($id)
{
    global $log;
    $log->debug("Entering getCurrencySymbolandCRate(" . $id . ") method ...");
    // To initialize the currency information in cache
    getCurrencyName($id);
    $currencyinfo = VTCacheUtils::lookupCurrencyInfo($id);
    $rate_symbol['rate'] = $currencyinfo['rate'];
    $rate_symbol['symbol'] = $currencyinfo['symbol'];
    $log->debug("Exiting getCurrencySymbolandCRate method ...");
    return $rate_symbol;
}
开发者ID:hbsman,项目名称:vtigercrm-5.3.0-ja,代码行数:16,代码来源:CommonUtils.php

示例15: explode

$parentRoleList = $adb->query_result($result, 0, 'parentrole');
$replace_with = $parentRoleList;
$orgDepth = $adb->query_result($result, 0, 'depth');
//echo 'replace with is '.$replace_with;
//echo '<BR>org depth '.$orgDepth;
$parentRoles = explode('::', $parentRoleList);
if (in_array($fromid, $parentRoles)) {
    echo $mod_strings['ROLE_DRAG_ERR_MSG'];
    die;
}
$roleInfo = getRoleAndSubordinatesInformation($fromid);
$fromRoleInfo = $roleInfo[$fromid];
$replaceToStringArr = explode('::' . $fromid, $fromRoleInfo[1]);
$replaceToString = $replaceToStringArr[0];
//echo '<BR>to be replaced string '.$replaceToString;
$stdDepth = $fromRoleInfo['2'];
//echo '<BR> std depth '.$stdDepth;
//Constructing the query
foreach ($roleInfo as $mvRoleId => $mvRoleInfo) {
    $subPar = explode($replaceToString, $mvRoleInfo[1], 2);
    //we have to spilit as two elements only
    $mvParString = $replace_with . $subPar[1];
    $subDepth = $mvRoleInfo[2];
    $mvDepth = $orgDepth + ($subDepth - $stdDepth + 1);
    $query = "update vtiger_role set parentrole=?,depth=? where roleid=?";
    //echo $query;
    $adb->pquery($query, array($mvParString, $mvDepth, $mvRoleId));
    // Invalidate any cached information
    VTCacheUtils::clearRoleSubordinates($roleId);
}
header("Location: index.php?action=SettingsAjax&module=Settings&file=listroles&ajax=true");
开发者ID:sacredwebsite,项目名称:vtigercrm,代码行数:31,代码来源:RoleDragDrop.php


注:本文中的VTCacheUtils类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。