[Vtigercrm-commits] [vtiger-commits] r6973 - /vtigercrm/trunk/include/ListView/ListView.php
vtigercrm-commits at vtiger.fosslabs.com
vtigercrm-commits at vtiger.fosslabs.com
Thu Jun 8 07:46:30 EDT 2006
Author: richie
Date: Thu Jun 8 05:46:26 2006
New Revision: 6973
Log:
removed unwanted methods
Modified:
vtigercrm/trunk/include/ListView/ListView.php
Modified: vtigercrm/trunk/include/ListView/ListView.php
==============================================================================
--- vtigercrm/trunk/include/ListView/ListView.php (original)
+++ vtigercrm/trunk/include/ListView/ListView.php Thu Jun 8 05:46:26 2006
@@ -40,17 +40,6 @@
var $querey_where_has_changed = false;
var $display_header_and_footer = true;
-/**sets whether or not to display the xtemplate header and footer
- * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
- * All Rights Reserved.
- * Contributor(s): ______________________________________.
-*/
-function setDisplayHeaderAndFooter($bool){
- global $log;
- $log->debug("Entering setDisplayHeaderAndFooter(".$bool.") method ...");
- $this->display_header_and_footer = $bool;
- $log->debug("Exiting setDisplayHeaderAndFooter method ...");
-}
/**initializes ListView
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
@@ -79,17 +68,6 @@
$log->debug("Exiting ListView method ...");
}
}
-/**sets how many records should be displayed per page in the list view
- * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
- * All Rights Reserved.
- * Contributor(s): ______________________________________.
-*/
- function setRecordsPerPage($count){
- global $log;
- $log->debug("Entering setRecordsPerPage(".$count.") method ...");
- $this->records_per_page = $count;
- $log->debug("Exiting setRecordsPerPage method ...");
-}
/**sets the header title */
function setHeaderTitle($value){
global $log;
@@ -108,35 +86,6 @@
$this->header_text = $value;
$log->debug("Exiting setHeaderText method ...");
}
-/**sets the path for the XTemplate HTML file to be used this is only needed to be set if you are allowing ListView to create the XTemplate
- * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
- * All Rights Reserved.
- * Contributor(s): ______________________________________.
-*/
- function setXTemplatePath($value){
- global $log;
- $log->debug("Entering setXTemplatePath(".$value.") method ...");
- $this->xTemplatePath= $value;
- $log->debug("Exiting setXTemplatePath method ...");
-}
-
-/**this is a helper function for allowing ListView to create a new XTemplate it groups parameters that should be set into a single function
- * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
- * All Rights Reserved.
- * Contributor(s): ______________________________________.
-*/
- function initNewXTemplate($XTemplatePath, &$modString, $imagePath = null){
- global $log;
- $log->debug("Entering initNewXTemplate(".$XTemplatePath.",".$modString.",". $imagePath = null.") method ...");
- $this->setXTemplatePath($XTemplatePath);
- if(isset($modString))
- $this->setModStrings($modString);
- if(isset($imagePath))
- $this->setImagePath($imagePath);
- $log->debug("Exiting initNewXTemplate method ...");
-}
-
-
/**sets the parameters dealing with the db
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
@@ -203,13 +152,6 @@
}
-function displayArrow(){
- global $log;
- $log->debug("Entering displayArrow() method ...");
- $log->debug("Exiting displayArrow method ...");
-
-}
-
/**sets the theme used only use if it is different from the global
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
@@ -283,101 +225,6 @@
}
-/**INTERNAL FUNCTION creates an XTemplate DO NOT CALL THIS THIS IS AN INTERNAL FUNCTION
- * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
- * All Rights Reserved.
- * Contributor(s): ______________________________________.
-*/
- function createXTemplate(){
- global $log;
- $log->debug("Entering createXTemplate() method ...");
- if(!isset($this->xTemplate)){
- if(isset($this->xTemplatePath)){
- $this->xTemplate = new XTemplate ($this->xTemplatePath);
- $this->xTemplate->assign("APP", $this->local_app_strings);
- if(isset($this->local_mod_strings))$this->xTemplate->assign("MOD", $this->local_mod_strings);
- $this->xTemplate->assign("THEME", $this->local_theme);
- $this->xTemplate->assign("IMAGE_PATH", $this->local_image_path);
- $this->xTemplate->assign("MODULE_NAME", $this->local_current_module);
- }else{
- $log->error("NO XTEMPLATEPATH DEFINED CANNOT CREATE XTEMPLATE");
- }
- }
- $log->debug("Exiting createXTemplate method ...");
-}
-
-/**sets the XTemplate telling ListView to use newXTemplate as its current XTemplate
- * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
- * All Rights Reserved.
- * Contributor(s): ______________________________________.
-*/
- function setXTemplate(&$newXTemplate){
- global $log;
- $log->debug("Entering setXTemplate(".$newXTemplate.") method ...");
- $this->xTemplate = $newXTemplate;
- $log->debug("Exiting setXTemplate method ...");
-}
-
-/**returns the XTemplate
- * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
- * All Rights Reserved.
- * Contributor(s): ______________________________________.
-*/
- function getXTemplate(){
- global $log;
- $log->debug("Entering getXTemplate() method ...");
- $log->debug("Exiting getXTemplate method ...");
- return $this->xTemplate;
-}
-
-/**assigns a name value pair to the XTemplate
- * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
- * All Rights Reserved.
- * Contributor(s): ______________________________________.
-*/
- function xTemplateAssign($name, $value){
- global $log;
- $log->debug("Entering xTemplateAssign(".$name.",". $value.") method ...");
-
- if(!isset($this->xTemplate)){
- $this->createXTemplate();
- }
- $this->xTemplate->assign($name, $value);
- $log->debug("Exiting xTemplateAssign method ...");
-
-}
-
-/**INTERNAL FUNCTION returns the offset first checking the querey then checking the session if the where clause has changed from the last time it returns 0
- * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
- * All Rights Reserved.
- * Contributor(s): ______________________________________.
-*/
- function getOffset($localVarName){
- global $log;
- $log->debug("Entering getOffset(".$localVarName.") method ...");
- if($this->querey_where_has_changed){
- $this->setSessionVariable($localVarName,"offset", 0);
- }
- $offset = $this->getSessionVariable($localVarName,"offset");
- if(isset($offset)){
- $log->debug("Exiting getOffset method ...");
- return $offset;
- }
- $log->debug("Exiting getOffset method ...");
- return 0;
-}
-
-/**INTERNAL FUNCTION sets the offset in the session
- * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
- * All Rights Reserved.
- * Contributor(s): ______________________________________.
-*/
- function setOffset($localVarName, $value){
- global $log;
- $log->debug("Entering setOffset(".$localVarName.",". $value.") method ...");
- $this->setSessionVariable($localVarName, "offset", $value);
- $log->debug("Exiting setOffset method ...");
-}
/**INTERNAL FUNCTION sets a session variable
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
@@ -439,234 +286,6 @@
return $this->local_current_module."_".$localVarName."_".$varName;
}
-/**
-
- * @return void
- * @param unknown $seed
- * @param unknown $xTemplateSection
- * @param unknown $html_varName
- * @desc INTERNAL FUNCTION Handles List Views using seeds that extend SugarBean
- $XTemplateSection is the section in the XTemplate file that should be parsed usually main
- $html_VarName is the variable name used in the XTemplateFile e.g. TASK
- $seed is a seed that extends SugarBean
- * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc..
- * All Rights Reserved..
- * Contributor(s): ______________________________________..
- */
- function processSugarBean($xtemplateSection, $html_varName, $seed){
- global $log;
- $log->debug("Entering processSugarBean(".$xtemplateSection.",". $html_varName.",". $seed.") method ...");
- $current_offset = $this->getOffset($html_varName);
- $response = $seed->get_list($this->query_orderby, $this->query_where, $current_offset, $this->query_limit);
- $list = $response['list'];
- $row_count = $response['row_count'];
- $next_offset = $response['next_offset'];
- $previous_offset = $response['previous_offset'];
- $this->processListNavigation( $xtemplateSection,$html_varName, $current_offset, $next_offset, $previous_offset, $row_count);
- $log->debug("Exiting processSugarBean method ...");
- return $list;
-}
-
-/**
-
- * @return void
- * @param unknown $data
- * @param unknown $xTemplateSection
- * @param unknown $html_varName
- * @desc INTERNAL FUNCTION process the List Navigation
- * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
- * All Rights Reserved.
- * Contributor(s): ______________________________________..
- */
- function processListNavigation( $xtemplateSection, $html_varName, $current_offset, $next_offset, $previous_offset, $row_count ){
- global $log;
- $log->debug("Entering processListNavigation(".$xtemplateSection.",". $html_varName.",". $current_offset.",". $next_offset.",". $previous_offset.",". $row_count.") method ...");
- global $current_user;
- global $allow_exports;
- global $theme;
- $theme_path="themes/".$theme."/";
- $image_path=$theme_path."images/";
-
- $start_record = $current_offset + 1;
- if($row_count == 0)
- $start_record = 0;
- $end_record = $start_record + $this->records_per_page;
- // back up the the last page.
- if($end_record > $row_count+1)
- {
- $end_record = $row_count+1;
- }
- // Deterime the start location of the last page
- if($row_count == 0)
- $number_pages = 0;
- else
- $number_pages = floor(($row_count - 1) / $this->records_per_page);
- $last_offset = $number_pages * $this->records_per_page;
- if(empty($this->query_limit) || $this->query_limit > $this->records_per_page){
- $base_URL = $_SERVER['PHP_SELF'];
- if(isset($_SERVER['QUERY_STRING'])){
- $base_URL = ereg_replace("\&".$this->getSessionVariableName($html_varName,"ORDER_BY")."=[0-9a-zA-Z\_]*","",$base_URL .'?'.$_SERVER['QUERY_STRING']);
- $base_URL = ereg_replace("\&".$this->getSessionVariableName($html_varName,"offset")."=[0-9]*","",$base_URL);
- }
- if($_SERVER['REQUEST_METHOD'] == 'POST'){
- $base_URL .= '?';
- if(isset($_REQUEST['action'])) $base_URL .= '&action='.$_REQUEST['action'];
- if(isset($_REQUEST['record'])) $base_URL .= '&record='.$_REQUEST['record'];
- if(isset($_REQUEST['module'])) $base_URL .= '&module='.$_REQUEST['module'];
- }
- $base_URL .= "&".$this->getSessionVariableName($html_varName,"offset")."=";
- $current_URL = $base_URL.$current_offset;
- $start_URL = $base_URL."0";
- $previous_URL = $base_URL.$previous_offset;
- $next_URL = $base_URL.$next_offset;
- $end_URL = $base_URL.$last_offset;
- $sort_URL_base = $base_URL. "&".$this->getSessionVariableName($html_varName,"ORDER_BY")."=";
-
- $this->log->debug("Offsets: (start, previous, next, last)(0, $previous_offset, $next_offset, $last_offset)");
-
- if(0 == $current_offset){
- $start_link = '<img src="'.$image_path.'start_disabled.gif" border="0" align="absmiddle"> ';
- $previous_link = '<img src="'.$image_path.'previous_disabled.gif" border="0" align="absmiddle"> ';
- }else{
- $start_link = "<a href=\"$start_URL\"><img src='".$image_path."start.gif' border='0' align='absmiddle'></a>";
- $previous_link = "<a href=\"$previous_URL\"><img src='".$image_path."previous.gif' border='0' align='absmiddle'></a>";
- }
-
- if($last_offset <= $current_offset){
- $next_link = '<img src="'.$image_path.'next_disabled.gif" border="0" align="absmiddle"> ';
- $end_link = '<img src="'.$image_path.'end_disabled.gif" border="0" align="absmiddle"> ';
- }
- else{
- $end_link = "<a href=\"$end_URL\"><img src='".$image_path."end.gif' border='0' align='absmiddle'> </a>";
- $next_link = "<a href=\"$next_URL\"><img src='".$image_path."next.gif' border='0' align='absmiddle'></a>";
- }
- global $current_module;
- $this->log->info("Offset (next, current, prev)($next_offset, $current_offset, $previous_offset)");
- $this->log->info("Start/end records ($start_record, $end_record)");
- if($sort_URL_base !== "") $this->xTemplate->assign("ORDER_BY", $sort_URL_base);
- $this->xTemplate->assign("START_RECORD", $start_record);
- $this->xTemplate->assign("END_RECORD", $end_record-1);
- $this->xTemplate->assign("ROW_COUNT", $row_count);
- if ($start_link !== "") $this->xTemplate->assign("START_LINK", $start_link);
- if ($end_link !== "")$this->xTemplate->assign("END_LINK", $end_link);
- if ($next_link !== "") $this->xTemplate->assign("NEXT_LINK", $next_link);
- if ($previous_link !== "") $this->xTemplate->assign("PREVIOUS_LINK", $previous_link);
-
- $_SESSION['export_where'] = $this->query_where;
-
- $export_link = "<a target=\"_blank\" href=\"include\export.php?module=".$this->local_current_module."\" class=\"listFormHeaderLinks\">".$this->local_app_strings['LBL_EXPORT']."</a>";
-
- if ($_REQUEST['module']== 'Home' ||
- $this->local_current_module == 'Import' ||
- ($allow_exports=='none' || ( $allow_exports=='admin' && ! is_admin($current_user) ) ) )
- {
- $this->xTemplate->assign("EXPORT_LINK", "");
- }
- else
- {
- $this->xTemplate->assign("EXPORT_LINK", " [ ".$export_link." ]");
- }
- $this->xTemplate->parse($xtemplateSection.".list_nav_row");
- $log->debug("Exiting processListNavigation method ...");
- }
-}
-/**
-
- * @return void
- * @param unknown $data
- * @param unknown $xTemplateSection
- * @param unknown $html_varName
- * @desc INTERNAL FUNCTION handles the rows
- * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
- * All Rights Reserved.
- * Contributor(s): ______________________________________..
- */
- function processListRows(&$data,$xtemplateSection, $html_varName){
- global $log;
- $log->debug("Entering processListRows(".$data.",".$xtemplateSection.",". $html_varName.") method ...");
- $oddRow = true;
- foreach($data as $aItem)
- {
- $fields = $aItem->get_list_view_data();
- $this->xTemplate->assign($html_varName, $fields);
-
- if($oddRow)
- {
- $this->xTemplate->assign("ROW_COLOR", 'oddListRow');
- }
- else
- {
- $this->xTemplate->assign("ROW_COLOR", 'evenListRow');
- }
- $oddRow = !$oddRow;
-
- $aItem->list_view_parse_additional_sections($this->xTemplate, $xtemplateSection);
- $this->xTemplate->parse($xtemplateSection.".row");
- }
- $this->xTemplate->parse($xtemplateSection);
- $log->debug("Exiting processListRows method ...");
-}
-/**
-
- * @return void
- * @param unknown $seed
- * @param unknown $xTemplateSection
- * @param unknown $html_varName
- * @desc PUBLIC FUNCTION Handles List Views using seeds that extend SugarBean
- $XTemplateSection is the section in the XTemplate file that should be parsed usually main
- $html_VarName is the variable name used in the XTemplateFile e.g. TASK
- $seed is a seed there are two types of seeds one is a subclass of SugarBean, the other is a list usually created from a sugar bean using get_list
- if no XTemplate is set it will create a new XTemplate
- * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc..
- * All Rights Reserved..
- * Contributor(s): ______________________________________..
- */
- function processListView($seed, $xTemplateSection, $html_varName){
- global $log;
- $log->debug("Entering processListView(".$seed.",". $xTemplateSection.",". $html_varName.") method ...");
- if(!isset($this->xTemplate))
- $this->createXTemplate();
- $isSugarBean = is_subclass_of($seed, "SugarBean");
- $list = null;
- if($isSugarBean){
- $list = $this->processSugarBean($xTemplateSection, $html_varName, $seed);
- }else{
- $list = &$seed;
- }
-
- $this->processSortArrows($html_varName);
- $this->processListRows($list,$xTemplateSection, $html_varName);
- if($this->display_header_and_footer)
- echo get_form_header( $this->header_title, $this->header_text, false);
- $this->xTemplate->out($xTemplateSection);
- if($this->display_header_and_footer)
- echo get_form_footer();
- if($isSugarBean )
- echo "</td></tr>\n</table>\n";
- $log->debug("Exiting processListView method ...");
-
- //if(isset($_SESSION['validation'])){
- // print base64_decode('PGEgaHJlZj0naHR0cDovL3d3dy5zdWdhcmNybS5jb20nPlBPV0VSRUQmbmJzcDtCWSZuYnNwO1NVR0FSQ1JNPC9hPg==');
-//}
-
-}
-
-function processSortArrows($html_varName){
- global $log;
- $log->debug("Entering processSortArrows(".$html_varName.") method ...");
- $orderBy = $this->getSessionVariable($html_varName, "ORDER_BY_LAST");
- $desc = $this->getSessionVariable($html_varName, $orderBy.'_desc');
- $imgArrow = " <img border='0' src='".$this->local_image_path."/arrow_down.gif' >";
- if($desc){
- $imgArrow = " <img border='0' src='".$this->local_image_path."/arrow_up.gif' >";
- }
- if($orderBy == 'amount*1')
- $this->xTemplateAssign('amount_arrow', $imgArrow);
- else{
- $this->xTemplateAssign($orderBy.'_arrow', $imgArrow);
- }
- $log->debug("Exiting processSortArrows method ...");
-}
}
More information about the vtigercrm-commits
mailing list