Example #1
0
 function display()
 {
     $Data = $this->getObjData();
     $Display = '<table class="table ifx-table">';
     $Display .= '<thead>';
     foreach ($this->fieldset(isset($Data[0]) ? $Data[0] : $this->Obj) as $Column) {
         if (!isset($this->hiddenColumn[$Column])) {
             if (isset($this->columnTitles[$Column])) {
                 $Title = $this->columnTitles[$Column];
             } else {
                 $Title = ucfirst($Column);
             }
             $Display .= '<th><form method="post"><button type="submit" name="ifxTable[sortBy]" value="' . $Column . '">' . $Title . '</button></form></th>';
         }
     }
     $Display .= '</thead>';
     $Display .= '<tbody>';
     if (count($Data) > 0) {
         foreach ($Data as $Row) {
             $Display .= '<tr>';
             $cols = 0;
             foreach ($this->fieldset($Row) as $Column) {
                 if (!isset($this->hiddenColumn[$Column]) && !isset($this->dynamicColumn[$Column])) {
                     $Display .= '<td>' . $this->_formatField($Column, $Row->{$Column}) . '</td>';
                     $cols++;
                 }
                 if (isset($this->dynamicColumn[$Column])) {
                     $Fn = $this->dynamicColumn[$Column];
                     $Display .= '<td>' . $Fn($Row) . '</td>';
                     $cols++;
                 }
             }
             $Display .= '</tr>';
         }
     } else {
         $Display .= '<tr class="no-data"><td colspan="' . count($this->columnTitles) . '">No data Available</td></tr>';
     }
     $Display .= '</tbody>';
     $Display .= '<tfoot>';
     $Display .= '<tr><td colspan="' . $cols . '">';
     $Display .= '<div class="page-of-page">';
     $Display .= ($this->pageOffset < 1 ? 0 : $this->pageLimit * $this->pageOffset) + 1 . '-' . min($this->pageOffset < 1 ? $this->pageLimit : $this->pageLimit * ($this->pageOffset + 1), $this->Obj->found_rows()) . ' / ' . $this->Obj->found_rows();
     $Display .= '</div>';
     $Display .= '<form class="page-list" method="POST"><ul>';
     for ($page = 0; $page <= $this->Obj->found_rows() / $this->pageLimit; $page++) {
         $Display .= '<li' . ($page == $this->pageOffset ? ' class="active"' : '') . '><button type="submit" name="ifxTable[pageOffset]" value="' . $page . '">' . ($page + 1) . '</button></li>';
     }
     $Display .= '</ul></form>';
     $Display .= '</td></tr>';
     $Display .= '</tfoot>';
     $Display .= '</table>';
     return $Display;
 }
Example #2
0
 /**
  * Check is the value is unique
  *
  * @param mixed $Str
  * @return mixed
  */
 public function rule_unique($str, $field)
 {
     $Query = $this->Object->db->select($this->Object->_id())->where($field, $str)->get($this->Object->_table());
     //$SQL = 'SELECT '.$this->Object->_id().' FROM '.$this->Object->_table().' WHERE '.$field.'='.$this->Object->db->escape($str);
     //$Query = $this->Object->db->query($SQL);
     return $Query->num_rows() == 0;
 }
Example #3
0
 function display()
 {
     $Data = $this->getObjData();
     $this->saveSettings();
     echo '<table class="table ifx-table">';
     echo '<thead>';
     foreach ($this->Columns as $Column) {
         echo '<th>';
         if ($Column->sortable === true) {
             echo '<form method="post">';
             echo '<button type="submit" name="ifxTable[sortBy]" value="' . $Column->sortBy . '">';
             if (isset($this->sortedBy[$Column->sortBy]) && $this->sortedBy[$Column->sortBy] === 'ASC') {
                 echo '<i class="fa fa-sort-asc"></i>';
             } elseif (isset($this->sortedBy[$Column->sortBy]) && $this->sortedBy[$Column->sortBy] === 'DESC') {
                 echo '<i class="fa fa-sort-desc"></i>';
             } else {
                 echo '<i class="fa fa-sort"></i>';
             }
         }
         echo $Column->title;
         if ($Column->sortable === true) {
             echo '</form>';
         }
         echo '</th>';
     }
     echo '</thead>';
     echo '<tbody>';
     if (count($Data) > 0) {
         foreach ($Data as $Row) {
             echo '<tr>';
             foreach ($this->Columns as $Column) {
                 echo '<td>';
                 $formatFn = $Column->formatFn;
                 $Reflection = new ReflectionFunction($formatFn);
                 if ($Reflection->getNumberOfParameters() == 2) {
                     echo $formatFn($Row, $Row->{$Column->fieldname});
                 } else {
                     echo $formatFn($Row);
                 }
                 echo '</td>';
             }
             echo '</tr>';
         }
     } else {
         echo '<tr class="no-data"><td colspan="' . count($this->Columns) . '">No data Available</td></tr>';
     }
     echo '</tbody>';
     echo '<tfoot>';
     echo '<tr><td colspan="' . count($this->Columns) . '">';
     echo '<div class="page-of-page">';
     echo ($this->pageOffset < 1 ? 0 : $this->pageLimit * $this->pageOffset) + 1 . '-' . min($this->pageOffset < 1 ? $this->pageLimit : $this->pageLimit * ($this->pageOffset + 1), $this->Obj->found_rows()) . ' / ' . $this->Obj->found_rows();
     echo '</div>';
     echo '<form class="page-list" method="POST"><ul>';
     for ($page = 0; $page <= $this->Obj->found_rows() / $this->pageLimit; $page++) {
         echo '<li' . ($page == $this->pageOffset ? ' class="active"' : '') . '><button type="submit" name="ifxTable[pageOffset]" value="' . $page . '">' . ($page + 1) . '</button></li>';
     }
     echo '</ul></form>';
     echo '</td></tr>';
     echo '</tfoot>';
     echo '</table>';
     return;
 }
Example #4
0
 function __construct($ID = null)
 {
     $this->_table('image');
     parent::__construct($ID);
 }
Example #5
0
 public function save(ifx_Model &$Relationship = null)
 {
     $MustForceExistance = $this->nice_id;
     $this->total = $this->getSubTotal(FALSE);
     $this->postage = $this->getPostage(FALSE);
     //Get an orderstatus id
     if (empty($this->status)) {
         $this->status = mOrderStatus::firstid();
     }
     $Result = parent::save($Relationship);
     if ($Result) {
         //Save the order_items
         foreach ($this->items() as $Item) {
             if (is_a($Item, 'OrderItem')) {
                 $OrderItem = new mOrderItem();
                 $OrderItem->fromOrderItem($Item);
                 parent::save($OrderItem);
             }
         }
     }
     return $Result;
 }