User: elroy Date: 8/20/15 Time: 8:58 AM
Inheritance: extends Model
Exemplo n.º 1
0
 /**
  * Test set/get numbering style name
  */
 public function testSetGetNumStyle()
 {
     $expected = 'List Name';
     $object = new ListItem();
     $object->setNumStyle($expected);
     $this->assertEquals($expected, $object->getNumStyle());
 }
Exemplo n.º 2
0
 /**
  * New item factory
  * @param string $label
  * @param mixed $value
  */
 public function newItem($value, $label)
 {
     $item = new ListItem();
     $item->setLabel($label);
     $item->setValue($value);
     $this->addItem($item);
     return $item;
 }
Exemplo n.º 3
0
 /**
  * Переопределенный метод
  * для развертывания пользовательсткого элемента управления
  *
  */
 public function razvertka()
 {
     $this->listItems = null;
     // массив с строками таблицы "Little"
     $rows = $this->istok["rows"];
     // распишем эти данные так как нам хочется
     // ведь этот элемент наш личный,
     // можем его уродовать как хотим. ВИВАТ ООП!!..
     // пусть value => value, caption => text
     while ($row = mysql_fetch_array($rows, MYSQL_NUM)) {
         $text = $row[2];
         $li = new ListItem();
         $li->addText($text);
         $this->addListItem($li);
     }
 }
Exemplo n.º 4
0
 /**
  * @param	Product $product
  * @param	integer $qtd
  */
 public function __construct(Product $product, $qtd)
 {
     parent::__construct();
     $resourceBundle = Application::getInstance()->getBundle();
     $idProduct = $product->getIdProduct();
     $moneyformat = $resourceBundle->getString('MONEY_FORMAT');
     $productName = $product->getProductName();
     $productDescription = $product->getProductDescription();
     $productPrice = $product->getProductPrice();
     $form = $this->addChild(new Form('/?c=cart&a=change&p=' . $idProduct));
     //Imagem do produto
     $form->addChild(new Image($product->getProductImage(), $productName))->setTitle($productName)->setAttribute('width', 80)->setAttribute('height', 80);
     //Nome e descrição do produto
     $form->addChild(new Span())->addStyle('name')->addChild(new Text($productName));
     $form->addChild(new Span())->addStyle('desc')->addChild(new Text($productDescription));
     //Input com a quantidade de itens
     $form->addChild(new Label(new Text($resourceBundle->getString('QUANTITY'))))->addChild(new Input('qtd'))->setValue($qtd);
     //Preço unitário
     $form->addChild(new Span())->addStyle('price')->addChild(new Text(money_format($moneyformat, $productPrice)));
     //Preço total
     $form->addChild(new Span())->addStyle('total')->addChild(new Text(money_format($moneyformat, $qtd * $productPrice)));
     //Botões para edição e exclusão do item do carrinho
     $form->addChild(new Input('save', Input::SUBMIT))->setValue($resourceBundle->getString('SAVE'));
     $form->addChild(new Input('del', Input::SUBMIT))->setValue($resourceBundle->getString('DELETE'));
 }
 public function testRenderWithSingleContainerUnordered()
 {
     $list = ListElement::createUnordered()->addItem(ListItem::create()->appendText(Paragraph::create()->appendText('Item 1')))->addItem(ListItem::create()->appendText(Div::create()->appendText('Item 2')))->addItem(ListItem::create()->appendText(Span::create()->appendText('Item 3')));
     $expected = '<ul>' . '<li><p>Item 1</p></li>' . '<li><div>Item 2</div></li>' . '<li><span>Item 3</span></li>' . '</ul>';
     $rendered = $list->render();
     $this->assertEquals($expected, $rendered);
 }
Exemplo n.º 6
0
 /**
  * @param	Product $product
  */
 public function __construct(Product $product)
 {
     parent::__construct();
     $resourceBundle = Application::getInstance()->getBundle();
     $productName = $product->getProductName();
     $moneyFormat = $resourceBundle->getString('MONEY_FORMAT');
     $buy = $resourceBundle->getString('BUY');
     $definitionList = $this->addChild(new DefinitionList());
     $definitionList->addChild(new DefinitionTerm())->addChild(new Text($productName));
     $definitionList->addChild(new DefinitionDescription())->addStyle('description')->addChild(new Text($product->getProductDescription()));
     $definitionList->addChild(new DefinitionDescription())->addStyle('image')->addChild(new Image($product->getProductImage(), $productName))->setAttribute('width', 190)->setAttribute('height', 190)->setTitle($productName);
     $definitionList->addChild(new DefinitionDescription())->addStyle('price')->addChild(new Text(money_format($moneyFormat, $product->getProductPrice())));
     $this->addChild(new Anchor('/?c=cart&a=add&p=' . $product->getIdProduct()))->setTitle($buy)->addStyle('buy-button')->addChild(new Text($buy));
 }
Exemplo n.º 7
0
 public function __construct()
 {
     // Get contact points
     $creator = Flight::get('creator');
     $contactPoints = $creator->fetch()->contactPoints;
     $orQueryAry = array();
     if ($contactPoints) {
         foreach ($contactPoints as $point) {
             $q = ListItem::query();
             $q->equalTo('objectId', $point->getObjectId());
             $orQueryAry[] = $q;
         }
         $orQuery = ParseQuery::orQueries($orQueryAry);
         $orQuery->includeKey('itemType');
         $contactList = $orQuery->find();
         foreach ($contactList as $c) {
             $contact[$c->itemType->value]['name'] = $c->itemType->value;
             $contact[$c->itemType->value]['link'] = Creator::contactPointLink($c);
         }
     }
     $this->contact = $contact;
 }
 /**
  * Get depth
  */
 public function testDepth()
 {
     $iVal = rand(1, 1000);
     $oListItem = new ListItem('text', $iVal);
     $this->assertEquals($iVal, $oListItem->getDepth());
 }
Exemplo n.º 9
0
 public function echoFolderContents()
 {
     $list = new ListObject(false, null, ' data-mini="true" class="item-list folder-list nomargin" data-split-theme="d" data-theme="d"');
     $subitems = false;
     // folders
     $sth = $this->db->prepare('SELECT id,subitems,name FROM folders WHERE folder_id=? ORDER BY name');
     $sth->execute(array($this->id));
     //if ($sth->rowCount()) $list->addHeading('Folders');
     while ($row = $sth->fetch()) {
         $subitems = true;
         $item = new ListItem($row['name'], $this->domain . 'folder/' . $row['id'], '/css/fugue/folder-open.png', 'data-icon="false" data-mini="true"');
         if ($row['subitems'] > 0) {
             $item->setRightText($row['subitems']);
         }
         //$item->unsetBold();
         $list->addListItem($item);
     }
     // upcoming events & tasks
     /*
      * show all overdue tasks
      * show all events/tasks for today & future ordered by date, time
      * ...
      * show passed events
      * show completed tasks
      */
     $today = new DateTime();
     $today_time = strtotime($today->format('Y-m-d'));
     $event_ids = array();
     $sth = $this->db->prepare('SELECT table_name,id,name, ' . '`date`, ' . "DATE_FORMAT(`date`, '%b %e') AS 'date_format', " . "TIME_FORMAT(`time`, '%l:%i %p') AS 'time_format' " . "FROM `calendar` WHERE folder_id=?");
     //$sth->execute(array($this->id,$today->format('Y-m-d')));
     $sth->execute(array($this->id));
     if ($sth->rowCount()) {
         $subitems = true;
         $list->addHeading('Calendar & Tasks');
     }
     while ($row = $sth->fetch()) {
         /*
                     $this_date = new DateTime($row['date']);
                     $diff = $today->diff($this_date);
                     $day_diff = (int) $diff->format('%r%a');
                     $time = $row['time_format'] ? strtolower($row['time_format']) : null;
         */
         $this_time = strtotime($row['date']);
         $day_diff = floor(($this_time - $today_time) / 3600 / 24);
         if ($row['table_name'] == 'tasks') {
             // task
             $class = 'folder-task';
             $countdown = $row['date_format'] . ' - ';
             if ($day_diff < 0) {
                 // task is overdue
                 $class .= ' folder-task-overdue';
                 $countdown .= abs($day_diff) . ' days ago';
                 //$countdown = $diff->format('%d') . ' days ago';
             } elseif ($day_diff == 0) {
                 // task is today
                 $class .= ' folder-task-1';
                 $countdown .= 'Today';
                 $countdown .= $row['time_format'] ? ' ' . $row['time_format'] : '';
             } elseif ($day_diff == 1) {
                 $class .= ' folder-task-2';
                 $countdown .= 'Tomorrow';
                 $countdown .= $row['time_format'] ? ' ' . $row['time_format'] : '';
             } else {
                 // event is in the future
                 $countdown .= $day_diff . ' days';
             }
             $item = new ListItem($row['name'], $this->domain . 'task/' . $row['id'] . '/edit', '/css/fugue/tick.png', ' class="' . $class . '" data-icon="false" data-mini="true"');
             $item->setRightText($countdown);
             $list->addListItem($item);
             $subitems = true;
         } else {
             $success = false;
             if ($day_diff > -1) {
                 if ($row['table_name'] == 'events') {
                     $success = true;
                     $event_ids[$row['id']] = 1;
                 } else {
                     if (!isset($event_ids[$row['id']])) {
                         $event_ids[$row['id']] = 1;
                         $success = true;
                     }
                 }
             }
             if ($success) {
                 // event
                 $class = 'folder-event';
                 $countdown = $row['date_format'] . ' - ';
                 if ($day_diff == 0) {
                     // event is today
                     $class .= ' folder-event-1';
                     $countdown .= 'Today';
                     $countdown .= $row['time_format'] ? ' ' . $row['time_format'] : '';
                 } elseif ($day_diff == 1) {
                     $class .= ' folder-event-2';
                     $countdown .= 'Tomorrow';
                     $countdown .= $row['time_format'] ? ' ' . $row['time_format'] : '';
                 } else {
                     // event is in the future
                     $countdown .= $day_diff . ' days';
                 }
                 $item = new ListItem($row['name'], $this->domain . 'event/' . $row['id'] . '/edit', '/css/fugue/calendar-month.png', ' class="' . $class . '" data-icon="false" data-mini="true"');
                 $item->setRightText($countdown);
                 $list->addListItem($item);
             }
         }
     }
     // tasks with no date and a priority
     $sth = $this->db->prepare('SELECT id,name,priority ' . 'FROM `tasks` WHERE `folder_id`=? AND `date` IS NULL ' . 'AND `complete` IS NULL AND `priority` IS NOT NULL ' . 'ORDER BY `priority`,`name` ');
     $sth->execute(array($this->id));
     while ($row = $sth->fetch()) {
         $subitems = true;
         $class = 'folder-task folder-task-' . $row['priority'];
         $item = new ListItem($row['name'], $this->domain . 'task/' . $row['id'] . '/edit', '/css/fugue/tick.png', ' class="' . $class . '" data-icon="false" data-mini="true"');
         if ($row['priority']) {
             $item->setRightText($row['priority']);
         }
         $list->addListItem($item);
     }
     // tasks with no date and no priority
     $sth = $this->db->prepare('SELECT id,name ' . 'FROM `tasks` WHERE `folder_id`=? AND `date` IS NULL ' . 'AND `complete` IS NULL AND `priority` IS NULL ' . 'ORDER BY `name` ');
     $sth->execute(array($this->id));
     while ($row = $sth->fetch()) {
         $subitems = true;
         $item = new ListItem($row['name'], $this->domain . 'task/' . $row['id'] . '/edit', '/css/fugue/tick.png', 'class="folder-task" data-icon="false" data-mini="true"');
         $list->addListItem($item);
     }
     // notes
     $sth = $this->db->prepare('SELECT id,name ' . 'FROM `notes` WHERE `folder_id`=? ' . 'ORDER BY `name` ');
     $sth->execute(array($this->id));
     if ($sth->rowCount()) {
         $list->addHeading('Notes');
     }
     while ($row = $sth->fetch()) {
         $subitems = true;
         $link = $this->domain . 'note/' . $row['id'];
         $item = new ListItem($row['name'], $link, '/css/fugue/notebook-sticky-note.png', 'data-icon="false" data-mini="true"');
         $list->addListItem($item);
     }
     // files
     $sth = $this->db->prepare('SELECT id,name,path ' . 'FROM `files` WHERE `folder_id`=? ' . 'ORDER BY `name` ');
     $sth->execute(array($this->id));
     if ($sth->rowCount()) {
         $list->addHeading('Files');
     }
     while ($row = $sth->fetch()) {
         $subitems = true;
         $item = new ListItem($row['name'], $this->domain . 'file/' . $row['id'], '/css/fugue/disk-black.png', 'data-icon="false" data-mini="true"');
         $list->addListItem($item);
     }
     // bill
     $sth = $this->db->prepare('SELECT id,amount,`type`, ' . "DATE_FORMAT(`date`, '%b %e, %Y') AS 'date_format' " . 'FROM `client_trans` WHERE `folder_id`=? ' . 'ORDER BY `date` ');
     $sth->execute(array($this->id));
     if ($sth->rowCount()) {
         $sthx = $this->db->prepare('SELECT balance FROM folders WHERE id=?');
         $sthx->execute(array($this->id));
         $rowx = $sthx->fetch();
         $title = 'Bill';
         if ($rowx['balance']) {
             $title .= ' balance: $' . $rowx['balance'];
         }
         $list->addHeading($title);
     }
     while ($row = $sth->fetch()) {
         $subitems = true;
         $icon;
         $title;
         switch ($row['type']) {
             case 'fee':
                 $title = 'Fee charged: $' . $row['amount'];
                 $icon = '/css/fugue/money--minus.png';
                 break;
             case 'pay':
                 $icon = '/css/fugue/money--plus.png';
                 $title = 'Payment: $' . $row['amount'];
                 break;
             case 'trust':
                 $icon = '/css/fugue/money--exclamation.png';
                 $title = 'Trust payment: $' . $row['amount'];
                 break;
         }
         $item = new ListItem($title, $this->domain . 'bill/' . $row['id'] . '/edit', $icon, 'data-icon="false" data-mini="true"');
         $item->setRightText($row['cr_format']);
         $list->addListItem($item);
     }
     // passed events
     $events = false;
     $sth = $this->db->prepare('SELECT id,name, ' . '`date`, ' . "DATE_FORMAT(`date`, '%b %e, %Y') AS 'date_format', " . "TIME_FORMAT(`time`, '%l:%i %p') AS 'time_format' " . "FROM `events` WHERE folder_id=? ORDER BY `date` DESC");
     //$sth->execute(array($this->id,$today->format('Y-m-d')));
     $sth->execute(array($this->id));
     while ($row = $sth->fetch()) {
         $subitems = true;
         $this_time = strtotime($row['date']);
         $day_diff = floor(($this_time - $today_time) / 3600 / 24);
         if ($day_diff < 0 && !isset($event_ids[$row['id']])) {
             if (!$events) {
                 $list->addHeading('Completed');
                 $events = true;
             }
             $item = new ListItem($row['name'], $this->domain . 'event/' . $row['id'] . '/edit', '/css/fugue/calendar-month.png', ' class="' . $class . '" data-icon="false" data-mini="true"');
             $item->setRightText($row['date_format']);
             $list->addListItem($item);
         }
     }
     // completed tasks
     $sth = $this->db->prepare('SELECT id,name,complete ' . 'FROM `tasks` WHERE `folder_id`=? AND `complete` IS NOT NULL ORDER BY `complete` DESC');
     $sth->execute(array($this->id));
     while ($row = $sth->fetch()) {
         if (!$events) {
             $list->addHeading('Completed');
             $events = true;
         }
         $subitems = true;
         $comp_timestamp = strtotime($row['complete'] . ' UTC');
         $local_date = date('M j, Y', $comp_timestamp);
         $item = new ListItem($row['name'], $this->domain . 'task/' . $row['id'] . '/edit', '/css/fugue/tick.png', ' class="folderitem-complete" data-icon="false" data-mini="true"');
         $item->setRightText($local_date);
         $list->addListItem($item);
     }
     if (!$subitems) {
         $list->addText('Nothing in this folder.');
     }
     $list->echoList();
 }
Exemplo n.º 10
0
 public function __construct($id, Model $model, $index, $columnIndex)
 {
     parent::__construct($id, $model, $index);
     $this->columnIndex = $columnIndex;
 }
Exemplo n.º 11
0
 public function listAddresses($contact_id, $child_name, $child_id)
 {
     $list = new ListObject(true, null, 'class="item-list"');
     $list->addHeading('Addresses', 'New', $this->domain . $child_name . '/' . $child_id . '/' . $contact_id . '/address/new');
     $sthx = $this->db->prepare("SELECT con_addresses.abbr,`primary`,`street`,`type`,`foreign`, " . "`con_addresses`.`id` AS 'addr_id', " . "CONCAT(`loc_cities`.`name`,', ',`loc_states`.`abbr`,' ',`zip`) AS 'city_state' " . 'FROM `contacts` ' . 'JOIN `con_addresses` ON `contacts`.`id`=`con_addresses`.`contact_id` ' . 'LEFT OUTER JOIN `loc_cities` ON `con_addresses`.`city_id`=`loc_cities`.`id` ' . 'LEFT OUTER JOIN `loc_states` ON `loc_cities`.`state_id`=`loc_states`.`id` ' . 'WHERE `contact_id`=? ' . 'ORDER BY `con_addresses`.`primary` DESC,`con_addresses`.`created` DESC ');
     $sthx->execute(array($contact_id));
     if ($sthx->rowCount()) {
         while ($rowx = $sthx->fetch()) {
             $str_arr = explode(PHP_EOL, $rowx['street']);
             $item = new ListItem($str_arr[0], $this->domain . $child_name . '/' . $child_id . '/' . $contact_id . '/address/' . $rowx['addr_id'] . '/edit', '/css/fugue/card-address.png', 'class="mini-item"');
             for ($idx = 1; $idx < count($str_arr); $idx++) {
                 $item->addSubItem($str_arr[$idx]);
             }
             if ($rowx['city_state']) {
                 $item->addSubitem($rowx['city_state']);
             } else {
                 $item->addSubitem($rowx['foreign']);
             }
             $right = $rowx['abbr'] ? $rowx['abbr'] : $rowx['type'];
             //if ($rowx['primary']) $right = 'Primary: '.$right;
             if ($rowx['primary']) {
                 $right .= '  (primary)';
             }
             $item->setRightText($right);
             if ($rowx['ext']) {
                 $item->addSubItem($rowx['ext']);
             }
             $list->addListItem($item);
         }
     } else {
         $list->addText('No addresses.');
     }
     $list->echoList();
 }
Exemplo n.º 12
0
 /**
  * Get depth
  */
 public function testDepth()
 {
     $iVal = rand(1, 1000);
     $oListItem = new ListItem(htmlspecialchars('text', ENT_COMPAT, 'UTF-8'), $iVal);
     $this->assertEquals($iVal, $oListItem->getDepth());
 }
Exemplo n.º 13
0
 public function echoClient()
 {
     $sth = $this->db->prepare("SELECT `contact_id`,`ssn`,`aka`,`dba`, " . "DATE_FORMAT(`dob`, '%c-%e-%Y') AS 'dob_format' " . 'FROM `clients` ' . 'JOIN `contacts` ON `clients`.`contact_id`=`contacts`.`id` ' . 'WHERE `clients`.`id`=?');
     $sth->execute(array($this->id));
     if ($row = $sth->fetch()) {
         $this->contact_id = $row['contact_id'];
         // client info
         $list = new ListObject(true);
         $item = new ListItem($this->full_name, $this->domain . 'client/' . $this->id . '/edit', '/css/fugue/user.png', 'class="mini-item"');
         if ($row['dob_format']) {
             $item->addSubItem('DOB: ' . $row['dob_format']);
         }
         if ($row['ssn']) {
             $item->addSubItem('SSN: ' . $row['ssn']);
         }
         if ($row['aka']) {
             $item->addSubItem($paras[] = 'AKA: ' . $row['aka']);
         }
         if ($row['dba']) {
             $item->addSubItem($paras[] = 'DBA: ' . $row['dba']);
         }
         //$list->addItem($this->full_name, $this->domain.'client/'.$this->id.'/edit', '/css/fugue/user.png', $paras);
         $list->addListItem($item);
         $list->echoList();
         // cases
         $list = new ListObject(true, 'info', 'data-split-theme="c" class="case-list"');
         $list->addHeading('Cases', '<u>N</u>ew', $this->domain . 'case/new/' . $this->id);
         $sthx = $this->db->prepare("SELECT `closed`,`folders`.`id` AS 'folder_id'," . "`balance`,`docket`, " . "`employees`.`name` AS 'atty_name'," . "DATE_FORMAT(`opened`, '%c-%e-%y') AS 'open_format', " . "`folders`.`name` AS 'folder_name', " . "`case_types`.`name` AS 'type_name' " . 'FROM `folders` ' . 'LEFT OUTER JOIN `case_types` ON `folders`.`type_id`=`case_types`.`id` ' . 'JOIN `employees` ON `folders`.`emp_id`=`employees`.`id` ' . 'WHERE `client_id`=? AND `folders`.`folder_id` IS NULL ORDER BY `folders`.`opened` DESC');
         $sthx->execute(array($this->id));
         if ($sthx->rowCount()) {
             while ($rowx = $sthx->fetch()) {
                 $item = new ListItem($rowx['folder_name'], $this->domain . 'folder/' . $rowx['folder_id'], '/css/fugue/inbox-document-text.png', 'class="mini-item"');
                 $item->addSplit($this->domain . 'case/' . $rowx['folder_id'] . '/edit');
                 $item->setRightText($rowx['open_format']);
                 $subtext = '';
                 if ($rowx['type_name']) {
                     $subtext .= $rowx['docket'] ? $rowx['docket'] . ' - ' : '';
                     $subtext .= $rowx['type_name'] . ' case. ';
                 }
                 $subtext .= 'Attorney: ' . $rowx['atty_name'] . '. ';
                 if ($rowx['closed']) {
                     $subtext .= 'Case closed. ';
                 }
                 if ($rowx['fee_type']) {
                     if ($rowx['fee_type'] == 'appt') {
                         $subtext .= 'Court appointed.';
                     } else {
                         if ($rowx['balance']) {
                             $subtext .= 'Balance: $' . $rowx['balance'];
                         }
                     }
                 }
                 $item->addSubItem($subtext);
                 $list->addListItem($item);
             }
         } else {
             $list->addText('No cases.');
         }
         $list->echoList();
         $this->listAddresses($this->contact_id, 'client', $this->id);
         $this->listPhones($this->contact_id, 'client', $this->id);
     }
 }
Exemplo n.º 14
0
 public function Razvernuti()
 {
     // 1. Мы используем сейчас вполне опредленный элемент
     //    управления Orderlist.
     //    Для него не нужен $this->columneNames
     // 2. Развертываем элемент уже имея в ввиду его будущее
     //    Значит свойства имена и прочее продумываем заранее.
     /* Например шаблоны
         <ol name="name" id='id'>
           <li name="name1" id='id1'>
             TextNode(null, null, text.value)
           </li>
         </ol>
     
         <select name='name' id='id'>
           <option value='value'>
             TextNode(null, null, text.value)
           </option>
         </select>
     
         $start = "<select name='name' id='id'>";
         где name, id - заранее выверенные переменные (значения)
         $end = "</select>";
         или
         $start = new Combobox("name"); // $end не нужен
     
         Тогда получим: return $start . {middle} . $end;
     
         Остаётся расчитать {middle}.
     
         Здесь будет:
     
         while ($row = mysql_fetch_array($this->data, MYSQL_NUM)) {
           $value = $row[0];
           $text = $row[2];
           $option = new Option(null, null, $text, $value);
           $start->addItem($option);
         }
         $start->toString();
     
         то же для списка:
         $start = "<ol name='name' id='id'>";
         где name, id - заранее выверенные переменные (значения)
         $end = "</ol>";
         или
         $start = new OrderList("name"); // $end не нужен
     
         while ($row = mysql_fetch_array($this->data, MYSQL_NUM)) {
           $text = $row[2];
           $li = new ListItem();
           $li->addText($text);
           $start->addListItem($li);
         }
         $start->toString();
          */
     // Элемент заполняем
     $start = $this->obj;
     $start->setName("MyOrderList");
     // Добавим внутренние члены
     while ($row = mysql_fetch_array($this->data, MYSQL_NUM)) {
         $text = $row[2];
         $li = new ListItem();
         $li->addText($text);
         $start->addListItem($li);
         //print_r($li); echo PHP_EOL;
     }
     $start->toString();
 }
Exemplo n.º 15
0
 public function __construct()
 {
     parent::__construct();
     $this->addStyle('menu-item');
 }
Exemplo n.º 16
0
 public function echoContent()
 {
     echo '<div data-role="content">';
     $list = new ListObject(false, null, 'data-filter="true" class="clients-list"');
     // setup query statement
     $stmt = "SELECT `clients`.`id` AS 'client_id'," . "`contacts`.`name` AS 'client_name'," . "CONCAT_WS(' ',`first_name`,`middle_name`,`suffix`) AS 'first_names', " . "`balance`,`open_cases` " . 'FROM `clients` ' . 'JOIN `contacts` ON `clients`.`contact_id`=`contacts`.`id` ';
     if ($this->status == '/open') {
         $stmt .= 'WHERE `open_cases`>0 ';
     } elseif ($this->status == '/closed') {
         $stmt .= 'WHERE `open_cases`=0 ';
     }
     if ($this->sort == '/balance') {
         $stmt .= 'ORDER BY `balance` DESC ';
     } elseif ($this->sort == '/paid') {
         $stmt .= 'ORDER BY `last_payment` ';
     } else {
         $stmt .= 'ORDER BY `contacts`.`name` ';
     }
     $sth = $this->db->prepare($stmt);
     $sth->execute();
     if ($sth->rowCount()) {
         while ($row = $sth->fetch()) {
             $title = $row['client_name'];
             $title .= $row['first_names'] ? ', ' . $row['first_names'] : '';
             $item = new ListItem($title, $this->domain . 'client/' . $row['client_id'], '/css/fugue/user.png', 'class="mini-item" data-mini="true" data-icon="false"', 'target="_blank"');
             $open_cases = $row['open_cases'] == 1 ? '1 open case.' : $row['open_cases'] . ' open cases.';
             $balance = $row['balance'] > 0 ? '$' . $row['balance'] : null;
             if ($balance) {
                 $open_cases .= ' ' . $balance;
             }
             $item->setRightText($open_cases);
             $list->addListItem($item);
         }
     } else {
         $list->addText('No clients.');
     }
     $list->echoList();
     echo '</div>';
 }
Exemplo n.º 17
0
 function viewme($id, $classname, $classID)
 {
     //        echo "List : ".$id." ".$classname." ".$classID;
     $id = tin($id);
     $list = new Lists();
     $list->getByID($id);
     $li = new ListItem();
     $arrLi = $li->getWhere("list_parent_id = '{$id}' ORDER BY list_urutan DESC");
     $arr['list'] = $list;
     $arr['arrLi'] = $arrLi;
     $layout_id = $list->list_layout;
     $file = Layout::getFile($layout_id);
     //        echo "Pages/".$layout_id."/".$file;
     Mold::theme("Pages/" . $layout_id . "/" . $file, $arr);
     //pr($list);
 }