if ('data:image/jpeg;base64,' == substr($image, 0, 23)) { $b64 = substr($image, 22); // Radix::dump($b64); $jpg_data = base64_decode($b64); $dir = sprintf('%s/webroot/img/content/contact/%u', APP_ROOT, $this->Contact['id']); if (!is_dir($dir)) { mkdir($dir, 0755, true); } $jpg_file = sprintf('%s/0.jpg', $dir); $res = file_put_contents($jpg_file, $jpg_data); if (0 == $res) { Session::flash('fail', 'Unable to write the snapshot'); } } if ('data:image/png;base64,' == substr($image, 0, 22)) { $b64 = substr($image, 22); Radix::dump($b64); $png_data = base64_decode($b64); $dir = sprintf('%s/webroot/img/content/contact/%u', APP_ROOT, $this->Contact['id']); if (!is_dir($dir)) { mkdir($dir, 0755, true); } $png_file = sprintf('%s/0.png', $dir); $res = file_put_contents($png_file, $png_data); if (0 == $res) { Session::flash('fail', 'Unable to write the snapshot'); } } Session::flash('info', 'Capture Saved'); Radix::redirect('/contact/view?c=' . $this->Contact['id']); }
// echo ImperiumView::mruDraw(); } // if (!empty($this->title_one)) { // echo '<h2>' . $this->title_one . '</h2>'; // } // if (!empty($this->title_two)) { // echo $this->title_two; // } echo '</header>'; // Menu for Authenticated Users Only // $auth = Zend_Auth::getInstance(); // Core of Page echo '<div id="core">'; if (!empty($_ENV['h1'])) { echo '<h1>' . $_ENV['h1'] . '</h1>'; } echo Session::flash(); echo $this->body; echo '</div>'; // #core // Radix::dump(str_replace('<br>', "\n", Radix::info())); // Radix::dump($_SESSION); ?> <footer> <a href="http://imperium.edoceo.com">Imperium</a> © 2001-2014 <a href="http://edoceo.com/">Edoceo, Inc</a> </footer> </body> </html> <?php
// $this->_s->EmailComposeMessage->body.= "\n\nSincerely,\n"; // $this->_s->EmailComposeMessage->body.= ' ' . $this->_c->Company->name . "\n\n"; // $this->_s->EmailComposeMessage->body.= 'PS: The linked files are in Adobe PDF format. You must have Acrobat Reader (or other compatible software) installed to view these documents.'; // $this->_s->ReturnTo = sprintf('/workorder/view/id/%d?sent=true',$wo->id); $this->_s->ReturnGood = sprintf('/workorder/view?w=%d?sent=good', $wo->id); $this->_s->ReturnFail = sprintf('/workorder/view?w=%d?sent=fail', $wo->id); Radix::redirect('/email/compose'); break; case 'save': $list = array('contact_id', 'date', 'kind', 'base_rate', 'base_unit', 'requester', 'note'); foreach ($list as $x) { $wo[$x] = trim($_POST[$x]); } $wo->save(); if ($id) { Session::flash('info', "Work Order #{$id} saved"); } else { $id = $wo['id']; Session::flash('info', "Work Order #{$id} created"); } Radix::redirect('/workorder/view?w=' . $id); break; case 'void': $sql = 'UPDATE workorder_item SET status = ? WHERE workorder_id = ? AND status = ?'; SQL::query($sql, array('Void', $wo->id, 'Pending')); $wo['status'] = 'Void'; $wo->save(); Session::flash('info', "Work Order #{$wo->id} voided"); Radix::redirect('/'); break; }
} // Save to DB if (empty($this->ContactChannel['id'])) { $this->ContactChannel['auth_user_id'] = $_SESSION['uid']; $this->ContactChannel->save(); Session::flash('info', 'Contact Channel saved'); } else { $this->ContactChannel->save(); Session::flash('info', 'Contact Channel created'); } Radix::redirect('/contact/view?c=' . $this->Contact['id']); break; case 'cancel': Radix::redirect('/contact/view?c=' . $this->Contact['id']); case 'delete': $this->ContactChannel->delete(); Session::flash('info', 'Contact Channel #' . $id . ' was deleted'); Radix::redirect('/contact/view?c=' . $this->Contact['id']); break; } // Save Primary if Indicated /* if ($this->data['ContactChannel']['primary'] == 1) { $this->Contact->id = $this->Session->read('Contact.id'); if ($this->data['ContactChannel']['kind'] == ContactChannel::PHONE) $this->Contact->saveField('Contact.phone',$this->data['ContactChannel']['data'],false); if ($this->data['ContactChannel']['kind'] == ContactChannel::EMAIL) $this->Contact->saveField('Contact.email',$this->data['ContactChannel']['data'],false); } */
<?php /** @file @brief Interface to the Search Options */ namespace Edoceo\Imperium; use Edoceo\Radix; use Edoceo\Radix\Session; use Edoceo\Radix\DB\SQL; switch ($_POST['a']) { case 'rebuild': require_once APP_ROOT . '/lib/Search.php'; Search::update(); Session::flash('info', 'Search Index Updated'); break; } // Collect Search Term $q = null; if (!empty($_GET['q'])) { $q = trim($_GET['q']); } // Search Commands switch (substr($q, 0, 1)) { case '!': break; case '#': // Something with this Tag or Keyword break; case '$':
break; case 'delete': $I = new Invoice($ii['invoice_id']); $I->delInvoiceItem($ii['id']); // $ii->delete(); Session::flash('warn', sprintf('Invoice Item #%d was deleted', $ii['id'])); Radix::redirect('/invoice/view?i=' . $I['id']); break; case 'save': $ii['invoice_id'] = intval($_POST['invoice_id']); foreach (array('kind', 'date', 'quantity', 'rate', 'unit', 'name', 'note', 'tax_rate') as $x) { $ii[$x] = trim($_POST[$x]); } // Save to DB $ii->save(); Session::flash('info', sprintf('Invoice Item #%d saved', $ii['id'])); // @todo Update the Balance (Sloppy, should be in IV->saveItem() $iv = new Invoice($_POST['invoice_id']); $iv->save(); Radix::redirect('/invoice/view?i=' . $ii['invoice_id']); break; // case 'create': // case 'create': default: // Create // Create if (empty($_GET['id']) && !empty($_GET['i']) && intval($_GET['i']) > 0) { $this->title = array('Invoice', 'Item', 'Create'); $this->Invoice = new Invoice(intval($_GET['i'])); $this->InvoiceItem = new InvoiceItem(null); $this->InvoiceItem['invoice_id'] = $this->Invoice['id'];
use Edoceo\Radix; use Edoceo\Radix\Session; use Edoceo\Radix\DB\SQL; $sql = 'SELECT id, name, cts FROM base_note'; // $this->_d->select(); $sql .= ' WHERE link IS NULL OR link = \'\''; $sql .= ' ORDER BY name'; // $sql->from('base_note',array('id','name','cts')); // $sql->where('link is null'); // $sql->order(array('name')); $res = SQL::fetch_all($sql); // $page = Zend_Paginator::factory($sql); // $page->setCurrentPageNumber($this->_request->getParam('page')); // $page->setItemCountPerPage(30); // $page->setPageRange(10); // if ($cpage->getTotalItemCount()) { if (0 != count($res)) { $a_id = $res[0]['id']; $z_id = $res[count($res)]['id']; $title = array(); $title[] = sprintf('Notes %d through %d', $a_id, $z_id); $title[] = sprintf('Page %d of %d', 1, 99); $_ENV['title'] = $title; } else { $_ENV['title'] = 'Notes'; Session::flash('info', 'There are no notes created'); } // $this->view->Page = $page; // echo $this->paginationControl($this->Page,'All','../elements/page-control.phtml'); echo Radix::block('note-list', array('list' => $res, 'page' => 1)); // echo $this->paginationControl($this->Page,'All','../elements/page-control.phtml');
<?php /** */ namespace Edoceo\Imperium; use Edoceo\Radix; use Edoceo\Radix\Session; Session::kill(); Radix::redirect('/auth/sign-in');
break; // Save the Updated Invoice // Save the Updated Invoice case 'save': // Save Request foreach (array('contact_id', 'date', 'kind', 'status', 'bill_address_id', 'ship_address_id', 'note') as $x) { $Invoice[$x] = trim($_POST[$x]); } if (empty($Invoice['flag'])) { $Invoice->setFlag(Invoice::FLAG_OPEN); } $Invoice->save(); if ($id) { Session::flash('info', 'Invoice #' . $Invoice['id'] . ' saved'); } else { Session::flash('info', 'Invoice #' . $Invoice['id'] . ' created'); } Radix::redirect('/invoice/view?i=' . $Invoice['id']); break; // Email the Invoice // Email the Invoice case 'send': $co = new Contact($Invoice['contact_id']); // Sent Good if ($_GET['sent'] == 'true') { $msg = 'Invoice #' . $Invoice['id'] . ' sent to ' . $this->_s->EmailSentMessage->to; unset($this->_s->EmailSentMessage->to); Base_Diff::note($iv, $msg); $this->_s->msg = $msg; $this->redirect('/invoice/view?i=' . $Invoice['id']); }
$ce = new Event(); $ce['contact_id'] = $C['id']; $ce['cts'] = $_SERVER['REQUEST_TIME']; // Create Time $ce['xts'] = $_SERVER['REQUEST_TIME'] + 86400 * 4; // Alert Time $ce['name'] = 'Ping this Contact'; $ce->save(); Session::flash('info', 'Contact #' . $id . ' event added'); Radix::redirect('/contact'); break; case 'save': $C['auth_user_id'] = $_SESSION['uid']; $C['account_id'] = intval($_POST['account_id']); if (!empty($_POST['parent_id'])) { $C['parent_id'] = intval($_POST['parent_id']); } $C['kind'] = $_POST['kind']; $C['status'] = $_POST['status']; $C['contact'] = $_POST['contact']; $C['company'] = $_POST['company']; $C['title'] = $_POST['title']; $C['email'] = $_POST['email']; $C['phone'] = $_POST['phone']; $C['url'] = $_POST['url']; $C['tags'] = $_POST['tags']; $C->save(); Session::flash('info', "Contact #{$C['id']} saved"); Radix::redirect('/contact/view?c=' . $C['id']); } // Radix::dump($_POST);
} // Radix::dump($res); $_SESSION['uid'] = $res['id']; acl::permit('/index'); acl::permit('/dashboard'); acl::permit('/search'); acl::permit('/block*'); acl::permit('/email*'); acl::permit('/file*'); acl::permit('/note*'); acl::permit('/account*'); acl::permit('/contact*'); acl::permit('/invoice*'); acl::permit('/workorder*'); acl::permit('/settings*'); Session::flash('info', 'Sign In Successful'); // Redirect $ret = '/'; if (!empty($_SESSION['return-path'])) { $ret = $_SESSION['return-path']; unset($_SESSION['return-path']); } Radix::redirect($ret); break; } // $db = Zend_Registry::get('db'); // $ss = Zend_Registry::get('session'); // $this->view->title = 'Login'; // // $req = $this->getRequest(); // if ($req->isPost()) {
<?php /** */ use Edoceo\Radix; use Edoceo\Radix\Session; use Edoceo\Imperium\Account; $a = new Account($_POST['id']); switch (strtolower($_POST['a'])) { case 'delete': $a->delete(); Session::flash('info', "Account #{$a['id']} deleted"); break; case 'save': $a['parent_id'] = $_POST['parent_id']; $a['account_tax_line_id'] = $_POST['account_tax_line_id']; $a['code'] = $_POST['code']; $a['kind'] = $_POST['kind']; $a['name'] = $_POST['name']; $a['bank_account'] = $_POST['bank_account']; $a['bank_routing'] = $_POST['bank_routing']; $a->save(); Session::flash('info', "Account #{$a['id']} saved"); } Radix::redirect('/account');
// Create Time $ce['xts'] = $_SERVER['REQUEST_TIME'] + 86400 * 4; // Alert Time $ce['name'] = 'Ping this Contact'; $ce->save(); Session::flash('info', 'Contact #' . $id . ' Event Added'); Radix::redirect('/contact'); break; case 'save': $co['auth_user_id'] = $_SESSION['uid']; $co['account_id'] = intval($_POST['account_id']); $co['parent_id'] = null; $co['kind'] = $_POST['kind']; $co['status'] = $_POST['status']; $co['contact'] = $_POST['contact']; $co['company'] = $_POST['company']; $co['title'] = $_POST['title']; $co['email'] = $_POST['email']; $co['phone'] = $_POST['phone']; $co['url'] = $_POST['url']; $co['tags'] = $_POST['tags']; $co->save(); if ($id) { Session::flash('info', "Contact #{$id} saved"); } else { $id = $co['id']; Session::flash('info', "Contact #{$id} created"); } Radix::redirect('/contact/view?c=' . $id); } Radix::dump($_POST);
use Edoceo\Radix\DB\SQL; $wo = new WorkOrder(intval($_GET['w'])); $_ENV['title'] = array("WorkOrder #{$wo['id']}", 'Build Invoice'); switch (strtolower($_POST['cmd'])) { case 'invoice': // if ($wo->status != 'Active') { // $this->_s->fail[] = 'Only Active WorkOrders may build an Invoice'; // $this->redirect('/workorder/view?w=' . $id); // } // $this->_d->beginTransaction(); $iv = $wo->toInvoice($_POST['invoice_id']); $x = $iv->getInvoiceItems(); $msg = sprintf('Invoice #%d created from Work Order #%d with %d items', $iv['id'], $wo['id'], count($x)); // Base_Diff::note($wo,$this->_s->info); // Base_Diff::note($iv,$this->_s->info); Session::flash('info', $msg); // $this->_d->commit(); Radix::redirect('/invoice/view?i=' . $iv['id']); break; } $this->WorkOrder = $wo; $w = array('woi.status in (?)' => array('Active', 'Complete')); $w = null; $this->WorkOrderItemList = $wo->getWorkOrderItems($w); $this->Contact = new Contact($wo['contact_id']); $this->InvoiceList = array(0 => '- New -'); $sql = 'SELECT * FROM invoice WHERE contact_id = ? AND status = ?'; $arg = array($this->Contact['id'], 'Active'); $res = SQL::fetch_all($sql, $arg); foreach ($res as $x) { $k = $x['id'];
// if ($p->count() == 0) { // $title[] = 'Contacts'; // } else { // $a_id = $p->getItem(1)->name; // $z_id = $p->getItem($p->getCurrentItemCount())->name; // // $title[] = sprintf('%s through %s',$a_id,$z_id); // } // $title[] = sprintf('Page %d of %d',$page->getCurrentPageNumber(),$page->count()); $_ENV['title'] = $title; // $this->view->Page = $p; /* $rq = $this->getRequest(); // Automatic Query? if ($a = $rq->getQuery('a')) { } //$ss->where('kind_id in (100,300)'); $sql->order(array('contact','company')); $sql->limitPage($this->view->Paginator->page,$this->view->Paginator->limit); // View! $this->view->ContactList = $db->fetchAll($sql); $this->view->title = array( 'Contacts', 'Page ' . $this->view->Paginator->page . ' of ' . $this->view->Paginator->pmax, ); */ $this->ContactList = SQL::fetch_all($sql, $arg); Session::flash('fail', SQL::lastError());
Session::flash('info', 'Account Ledger Entry #' . $id . ' updated'); } else { Session::flash('info', 'Account Ledger Entry #' . $ale['id'] . ' created'); } } // Memorise the Transaction if (1 == $_POST['memorise']) { // $awj->save(); Session::flash('info', 'Account Wizard Memorised'); } // File! if (!empty($_FILES['file']) && Base_File::goodPost($_FILES['file'])) { $bf = Base_File::copyPost($_FILES['file']); $bf['link'] = $bf->link($aje); $bf->save(); Session::flash('info', 'Attachment Created'); } // Commit and Redirect // $this->_d->commit(); // if ('Apply' == $_POST['c']) { // $this->_redirect('/account/transaction?id=' . $aje->id); // } if ('save-copy' == $_POST['a']) { // $_SESSION['account-transaction'] = $aje; // $_SESSION['account-transaction-list' = array(); // ] = $ale; // // $_SESSION['new-transaction'] = $aje; Radix::redirect('/account/transaction'); } // Redirect Back $ret = '/account/ledger';
$body = str_replace('$wi_name', $woi['name'], $body); $body = str_replace('$wi_note', $woi['note'], $body); $body = str_replace('$wi_quantity_est', $woi['e_quantity'], $body); $body = str_replace('$wi_rate_est', $woi['e_rate'], $body); $body = str_replace('$wi_unit_est', $woi['e_unit'], $body); $body = str_replace('$wi_quantity', $woi['a_quantity'], $body); $body = str_replace('$wi_rate', $woi['a_rate'], $body); $body = str_replace('$wi_unit', $woi['a_unit'], $body); $body = str_replace('$wi_cost', sprintf('%0.4f', $woi['a_quantity'] * $woi['a_rate']), $body); $body = str_replace('$wi_status', $woi['status'], $body); $mail['body'] = $body; $_SESSION['mail-compose'] = $mail; // Want to Add This History $_SESSION['return-path'] = '/workorder/view?w=' . $wo['id']; Radix::redirect('/email/compose'); } Radix::redirect('/workorder/view?w=' . $wo['id']); break; case 'view': $id = intval($_GET['id']); $woi = new WorkOrderItem($id); if (empty($woi['id'])) { Session::flash('fail', sprintf('Cannot find Work Order Item #%d', $id)); return; } $this->WorkOrder = new WorkOrder($woi['workorder_id']); $this->WorkOrderItem = $woi; break; default: Radix::dump($_POST); }
case 'save': $n['kind'] = $_POST['kind']; // Append on Conversation if ($n['kind'] == 'Conversation') { $data = trim($n['note']); $data .= "\n---\n# " . date('D \\t\\h\\e jS \\o\\f F Y \\a\\t H:i') . "\n"; $data .= $_POST['note']; $n['note'] = trim($data); } else { $n['note'] = trim($_POST['note']); } $x = str_replace(array('<br>', '<br/>', '<br />'), "\n", $n['note']); $x = trim(strip_tags($x)); $n['name'] = strtok($x, "\n"); $n['link'] = $_POST['link']; $n->save(); if ($id) { Session::flash('info', "Note #{$id} saved"); } else { $id = $n['id']; Session::flash('info', "Note #{$id} created"); } $back_page = '/note/view?id=' . $id; } // Redirect Out if (!empty($n['link'])) { if (preg_match('/(contact|invoice|workorder):(\\d+)/', $n['link'], $m)) { $back_page = '/' . $m[1] . '/view?' . substr($m[1], 0, 1) . '=' . $m[2]; } } Radix::redirect($back_page);