• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List

E:/E/GEAMP/www/openbiz/openbiz/bin/easy/element/ColumnList.php

00001 <?PHP
00017 include_once("OptionElement.php");
00018 
00027 class ColumnList extends OptionElement
00028 {
00029     public $m_Sortable;
00030     public $m_ColumnStyle;
00031 
00038     protected function readMetaData(&$xmlArr)
00039     {
00040         parent::readMetaData($xmlArr);
00041         $this->m_Sortable = isset($xmlArr["ATTRIBUTES"]["SORTABLE"]) ? $xmlArr["ATTRIBUTES"]["SORTABLE"] : null;
00042         $this->m_Link = isset($xmlArr["ATTRIBUTES"]["LINK"]) ? $xmlArr["ATTRIBUTES"]["LINK"] : null;
00043         $this->m_ColumnStyle = $this->m_Style;
00044     }
00045 
00052     public function setSortFlag($flag=null)
00053     {
00054         $this->m_SortFlag = $flag;
00055     }
00056 
00062     protected function getLink()
00063     {
00064         if ($this->m_Link == null)
00065             return null;
00066         $formobj = $this->getFormObj();
00067         return Expression::evaluateExpression($this->m_Link, $formobj);
00068     }
00069 
00070 
00076    public function renderLabel()
00077     {
00078         if ($this->m_Sortable == "Y")
00079         {
00080             $rule = $this->m_Name;
00081 
00082             $function = $this->m_FormName . ".SortRecord($rule,$this->m_SortFlag)";
00083             if($this->m_SortFlag == "ASC" || $this->m_SortFlag == "DESC"){
00084               $class=" class=\"current\" ";
00085             }else{
00086               $class=" class=\"normal\" ";
00087             }
00088             if ($this->m_SortFlag == "ASC")
00089               $span_class = " class=\"sort_up\" ";
00090             else if ($this->m_SortFlag == "DESC")
00091                 $span_class = " class=\"sort_down\" ";
00092             $sHTML = "<a href=javascript:Openbiz.CallFunction('" . $function . "') $class ><span $span_class >" . $this->m_Label ."</span>";            
00093             $sHTML .= "</a>";
00094         }
00095         else
00096         {
00097             $sHTML = $this->m_Label;
00098         }
00099         return $sHTML;
00100     }
00101 
00107     public function render()
00108     {
00109         $fromList   = array();
00110         $this->getFromList($fromList);
00111         $value_arr  = explode(',', $this->m_Value);
00112         $style      = $this->getStyle();
00113         $func       = $this->getFunction();
00114 
00115         $selectedStr = '';
00116 
00117         $selectedStr = $this->m_Value;
00118 
00119         foreach ($fromList as $opt)
00120         {
00121             $test = array_search($opt['val'], $value_arr);
00122             if (!($test === false))
00123             {
00124                 $selectedStr = $opt['txt'] ;
00125                 break;
00126             }
00127         }
00128 
00129         if ($this->m_Link)
00130         {
00131             $link = $this->getLink();
00132             $sHTML = "<a href=\"$link\" $func $style>" . $selectedStr . "</a>";
00133         }
00134         else
00135             $sHTML = "<span $func $style>" . $selectedStr . "</span>";
00136 
00137         return $sHTML;
00138     }
00139 }
00140 
00141 ?>

Generated on Thu Apr 19 2012 17:09:13 for openbiz by  doxygen 1.7.2