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

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

00001 <?php 
00002 include_once("ColumnText.php");
00003 
00004 class ColumnSorting extends ColumnText
00005 {
00006        public function render(){
00007               $func_up = $this->getBtnFunction('fld_sortorder_up');
00008               $func_down = $this->getBtnFunction('fld_sortorder_down');
00009               $formobj = $this->getFormObj();           
00010         
00011         
00012               //$this->m_EventHandlers = null;
00013               $value = $this->m_Text ? $this->getText() : $this->m_Value;
00014         
00015         if ($value == null || $value =="")
00016             return "";
00017 
00018         $style = $this->getStyle();
00019         $id = $this->m_Name;
00020 
00021         if ($this->m_Translatable == 'Y')
00022             $value = $this->translateString($value);
00023         
00024         if((int)$this->m_MaxLength>0){
00025                if(function_exists('mb_strlen') && function_exists('mb_substr')){
00026                      if(mb_strlen($value,'UTF8') > (int)$this->m_MaxLength){
00027                             $value = mb_substr($value,0,(int)$this->m_MaxLength,'UTF8').'...';
00028                      }             
00029                }else{
00030                      if(strlen($value) > (int)$this->m_MaxLength){
00031                             $value = substr($value,0,(int)$this->m_MaxLength).'...';
00032                      }             
00033                }
00034         }
00035         
00036         if ($value!=null)
00037         {
00038               if($this->m_DisplayFormat)
00039               {
00040                      $value = sprintf($this->m_DisplayFormat,$value);
00041               }
00042               if($this->m_Percent=='Y')
00043               {
00044                      $value = sprintf("%.2f",$value*100).'%';
00045               }
00046               
00047             if ($this->m_Link)
00048             {
00049                 $link = $this->getLink();
00050                 $target = $this->getTarget();
00051                 //$sHTML = "<a href=\"$link\" onclick=\"SetOnLoadNewView();\" $style>" . $val . "</a>";
00052                 $sHTML = "<a id=\"$id\" href=\"$link\" $target $func $style>" . $value . "</a>";
00053             }
00054             else
00055             {
00056                 $sHTML = "<span style=\"width:auto;height:auto;line-height:16px;\" $func>" . $value . "</span>";
00057             }
00058         }
00059         
00060               $sHTML = "<a $func_up  class=\"arrow_up\" href=\"javascript:;\"><img src=\"".Resource::getImageUrl()."/spacer.gif"."\" style=\"width:12px;height:12px;\" /></a> ".
00061                             $sHTML.
00062                             " <a $func_down  class=\"arrow_down\" href=\"javascript:;\"><img src=\"".Resource::getImageUrl()."/spacer.gif"."\" style=\"width:12px;height:12px;\" /></a>";
00063               
00064               return $sHTML;
00065        }
00066        
00067        public function getBtnFunction($event_name){
00068         $name = $this->m_Name;
00069         // loop through the event handlers
00070         $func = "";
00071 
00072         if ($this->m_EventHandlers == null)
00073             return null;
00074         $formobj = $this->getFormObj();
00075         
00076         $eventHandler = $this->m_EventHandlers->get($event_name);
00077                 
00078         $ehName = $eventHandler->m_Name;
00079         $event = $eventHandler->m_Event;
00080         $type = $eventHandler->m_FunctionType;
00081         if (!$event) return;
00082         if($events[$event]!=""){
00083            $events[$event]=array_merge(array($events[$event]),array($eventHandler->getFormedFunction()));
00084         }else{
00085            $events[$event]=$eventHandler->getFormedFunction();
00086         }
00087 
00088               foreach ($events as $event=>$function){
00089                      if(is_array($function)){
00090                             foreach($function as $f){
00091                                    $function_str.=$f.";";
00092                             }
00093                             $func .= " $event=\"$function_str\"";
00094                      }else{
00095                             $func .= " $event=\"$function\"";
00096                      }
00097               }
00098         return $func;              
00099        }
00100 }
00101 ?>

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