Example #1
0
 public function echoFolderEdit()
 {
     $success = true;
     $name;
     $id;
     if ($this->page_type == 'edit') {
         $sth = $this->db->prepare("SELECT `name` " . 'FROM `folders` WHERE `id`=?');
         $sth->execute(array($this->id));
         if ($row = $sth->fetch()) {
             $id = $this->id;
             $name = $row['name'];
         } else {
             $success = false;
         }
     }
     if ($success) {
         $form = new Form('folder');
         $form->addText('Folder name:', 'name', true, $name);
         $form->addHidden('id', $id);
         $form->addHidden('folder_id', $this->parent_folder_id);
         if ($this->page_type == 'edit' && ($this->admin || $this->emp_id == $this->folder_emp_id || $this->office_admin && $this->folder_office_id == $this->office_id)) {
             $move_arr = $this->moveFolderArr($this->parent_folder_id, $this->id);
             if (count($move_arr) > 1) {
                 //$form->addHeading('Move');
                 $form->addSelect('Move to:', 'move', $move_arr);
             }
             $form->addDelete();
         }
         $form->echoForm();
     }
 }
Example #2
0
 public function echoClientEdit()
 {
     $id;
     $contact_id;
     $sex = 'm';
     $first_name;
     $middle_name;
     $last_name;
     $suffix;
     $ssn;
     $dob;
     $aka;
     $dba;
     $success = true;
     if ($this->page_type == 'edit') {
         $sth = $this->db->prepare("SELECT `contact_id`,`contacts`.`name` AS 'last_name'," . "`first_name`,`middle_name`,`suffix`,`sex`,`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()) {
             $id = $this->id;
             $contact_id = $row['contact_id'];
             $first_name = $row['first_name'];
             $middle_name = $row['middle_name'];
             $last_name = $row['last_name'];
             $suffix = $row['suffix'];
             $sex = $row['sex'] ? $row['sex'] : 'none';
             $ssn = $row['ssn'];
             $dob = $row['dob_format'];
             $aka = $row['aka'];
             $dba = $row['dba'];
         } else {
             $success = false;
         }
     }
     if ($success) {
         $form = new Form('client');
         $form->addHeading('Name');
         $form->addSelect('', 'sex', array('m' => 'Male', 'f' => 'Female', 'none' => 'None'), $sex);
         $form->addText('First name:', 'first_name', false, $first_name);
         $form->addText('Middle:', 'middle_name', false, $middle_name);
         $form->addText('Last (or biz name):', 'name', true, $last_name);
         $form->addText('Suffix (Jr/Sr/etc):', 'suffix', false, $suffix);
         $form->addHeading('Info');
         $form->addDate('Date of birth:', 'dob', false, true, $dob);
         $form->addText('SSN (no dashes):', 'ssn', false, $ssn, 'minlength="9" maxlength="9" digits="true"');
         $form->addText('AKA:', 'aka', false, $aka);
         $form->addText('DBA:', 'dba', false, $dba);
         $form->addHidden('id', $id);
         $form->addHidden('contact_id', $contact_id);
         if ($this->admin && $this->page_type == 'edit') {
             $form->addDelete();
         }
         $form->echoForm();
     }
 }
Example #3
0
 public function echoEmail()
 {
     $email;
     $alert = 0;
     $primary = 0;
     $success = true;
     if ($this->contact_item_id) {
         $sth = $this->db->prepare("SELECT `primary`,`alert`,`email` " . 'FROM `con_emails` ' . 'WHERE `con_emails`.`id`=?');
         $sth->execute(array($this->contact_item_id));
         if ($row = $sth->fetch()) {
             $email = $row['email'];
             $alert = $row['alert'];
             $primary = $row['primary'];
         } else {
             $success = false;
         }
     }
     if ($success) {
         $form = new Form('email');
         $form->addText('Email:', 'email', true, $email, 'email="true"');
         $form->addSwitch('Primary:', 'primary', array('0' => 'No', '1' => 'Yes'), $primary);
         $form->addSwitch('Receive alerts:', 'alert', array('0' => 'No', '1' => 'Yes'), $alert);
         $form->addHidden('id', $this->contact_item_id);
         $form->addHidden('contact_id', $this->contact_id);
         //$form->addHidden('callback', $this->form_callback);
         if ($this->contact_item_id) {
             $form->addDelete();
         }
         $form->echoForm();
     }
 }
Example #4
0
 public function echoNoteEdit()
 {
     $success = true;
     $today = new DateTime();
     $date = $today->format('n-j-Y');
     $body;
     if ($this->page_type != 'new') {
         $sth = $this->db->prepare("SELECT `body`, " . "DATE_FORMAT(`date`, '%c-%e-%Y') AS 'date_format' " . 'FROM `notes` WHERE `id`=?');
         $sth->execute(array($this->id));
         if ($row = $sth->fetch()) {
             $id = $this->id;
             $body = $row['body'];
             $date = $row['date_format'];
         } else {
             $success = false;
         }
     }
     if ($success) {
         $form = new Form('note');
         // cant directly comment out below regex
         if (false) {
             if ($this->platform == 'and') {
                 $nl = preg_replace('#<br\\s*/?>#i', "\r\n", $body);
                 $form->addTextArea('', 'bodysource', true, $nl);
             } else {
                 $form->addTextArea('', 'body', true, $body);
             }
         }
         // end comment out
         $form->addTextArea('', 'body', true, $body);
         $form->addDate('Date:', 'date', true, true, $date);
         if ($this->page_type == 'edit' && ($this->admin || $this->emp_id == $this->folder_emp_id || $this->office_admin && $this->folder_office_id == $this->office_id)) {
             $move_arr = $this->moveFolderArr($this->parent_folder_id);
             if (count($move_arr) > 1) {
                 //$form->addHeading('Move');
                 $form->addSelect('Move to:', 'move', $move_arr);
             }
             $form->addDelete();
         }
         $form->addHidden('id', $id);
         $form->addHidden('folder_id', $this->parent_folder_id);
         $form->echoForm();
         // add link popup
         echo '<div data-role="popup" id="link-popup" class="ui-content">' . '<form>' . '<h4>Create link</h4>' . '<label for="link-url">URL</label>' . '<input name="link-url" id="link-url" type="text">' . '<button id="link-ok">OK</button>' . '</form>' . '</div>';
     }
 }