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(); }
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); } }