$username = request_isset('username'); $password = request_isset('password'); switch ($page_action) { case 'update_by_id': $db_update_success = PasswordManager::updateRecord($PASSMAN_ID, $USER_ID, $site, $url, $username, $password); break; case 'add_password': $db_add_success = PasswordManager::addRecord($USER_ID, $site, $url, $username, $password); break; case 'delete_by_id': $db_delete_success = PasswordManager::deleteRecord($PASSMAN_ID, $USER_ID); break; } $passman_records = PasswordManager::getAllRecords($USER_ID); $page_title = 'PassMan'; $alt_menu = getAddButton(); // build add view $addView = new AddView('Add', 'add_password'); $addView->addRow('site', 'Site'); $addView->addRow('url', 'URL'); $addView->addRow('username', 'Username'); $addView->addRow('password', 'Password'); // build table view $tableView = new TableView(array('Site', 'Username', 'Password', '')); foreach ($passman_records as $record) { $tableView->addRow(array(TableView::createCell('site', '<a href="' . $record->getUrl() . '" target="_blank">' . $record->getSite() . '</a>'), TableView::createCell('username', $record->getUsername()), TableView::createCell('password', '<span class="mask">************</span><span class="password-actual">' . $record->getPassword() . '</span>'), TableView::createEdit($record->getPassmanId()))); } // load views to be used in front end $views_to_load = array(); $views_to_load[] = '../../views/_add.php'; $views_to_load[] = '../../views/_table.php';
function getHeading($brand, $part, $id, $table, $fkid) { $add = getAddButton($id, $table, $fkid); return "\n <div class=\"panel-heading\">\n <span class=\"brandName\"> {$brand}:</span> \n <span class=\"partName\">{$part}</span>\n <span class=\"inventorycontrols\" > \n \n\n {$add} \n\n <form action=\"invdelete.php\" method=\"post\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"Delete Item\">\n <input type=\"hidden\" name=\"id\" value=\"{$id}\"></input>\n <input type=\"hidden\" name=\"table\" value=\"{$table}\"></input>\n <button type=\"submit\">\n <span class=\"glyphicon glyphicon-remove\" > </span>\n </button>\n </form>\n\n </span>\n </div>"; }
$url = request_isset('url'); switch ($page_action) { case 'update_by_id': $db_update_success = BookmarkManager::updateRecord($id, $title, $url); break; case 'add_bookmark': $db_update_success = BookmarkManager::addRecord($title, $url); break; case 'delete_by_id': $db_delete_success = BookmarkManager::deleteRecord($id); break; } $page_title = 'Bookmarks'; $search_target = 'bookmarks'; $bookmark_data = BookmarkManager::getAllRecords(); $alt_menu = getAddButton() . getSearchButton(); $searchModel = new SearchModel($search_target); $addModel = new AddModel('Add', 'add_bookmark'); $addModel->addRow('title', 'Title'); $addModel->addRow('url', 'URL'); $bookmarkModel = new TableModel('', $search_target); /*$bookmarkModel->addRow ( array ( TableView2::createCell ('site', 'Site', 'th'), TableView2::createCell () ));*/ while (($bookmark_row = mysql_fetch_array($bookmark_data)) != null) { $target = $sbookmark ? ' target="_blank"' : ''; $bookmarkModel->addRow(array(TableView2::createCell('bookmark', '<a href="' . $bookmark_row['url'] . '" ' . $target . '>' . $bookmark_row['title'] . '</a>'), TableView2::createEdit($bookmark_row['BOOKMARK_ID']))); } $views_to_load = array(); $views_to_load[] = ' ' . AddView2::render($addModel);
$id = $budget_id; $db_add_success = BudgetManager::addItemRecord($budget_id, $item_name, $amount, $qty, $category, $brand, $size, $size_unit, $tax, $sale); break; case 'delete_item_by_id': $id = BudgetManager::getBudgetIdFromItemId($item_id); $db_delete_success = BudgetManager::deleteItemRecord($item_id); break; case 'add_budget_item': $id = BudgetManager::addRecord($store, $date); break; } $spending_history_data = BudgetManager::getRecord($id); $items = BudgetManager::getItems($id); $receipt_total = 0; $page_title = 'Receipt | Budget'; $alt_menu = getAddButton() . getBackButton(); // add Item form $addModel = new AddModel('Add', 'add_receipt_item'); $addModel->addRow('item_name', 'Item'); $addModel->addRow('amount', 'Amount'); $addModel->addRow('qty', 'Qty', 1); $addModel->addRow('category', 'Category'); $addModel->addRow('brand', 'Brand'); $addModel->addRow('size', 'Size'); $addModel->addRow('size_unit', 'Units'); $addModel->addRow('sale', 'Sale'); $addModel->addOptionBox('tax', 'Tax', ['13%', '0%']); $addModel->addRow('budget_id', 'budget_id', $id); // build items table model $itemsModel = new TableModel('Items', 'budget'); $itemsModel->addRow(array(TableView2::createCell('total', 'total', 'th'), TableView2::createCell('qty', 'qty', 'th'), TableView2::createCell('tax', 'tax', 'th'), TableView2::createCell('amount', 'Amount', 'th'), TableView2::createCell('item_name', 'Item', 'th'), TableView2::createCell('category', 'Category', 'th'), TableView2::createCell('brand', 'Brand', 'th'), TableView2::createCell('size', 'Size', 'th'), TableView2::createCell('units', 'units', 'th'), TableView2::createCell('sale', 'sale', 'th'), TableView2::createCell()));
$db_delete_success = BudgetManager::deleteRecord($id); break; } $spending_history_data = BudgetManager::getAllRecords($year, $month); $filterDOM = ''; if ($year != null) { $filterDOM .= "<input type='hidden' name='year' value='{$year}' />"; } if ($month != null) { $filterDOM .= "<input type='hidden' name='month' value='{$month}' />"; } $page_title = 'Budget'; if (!(isset($_REQUEST['year']) && isset($_REQUEST['month']))) { $meta = "<meta http-equiv='refresh' content='0;url=index.php?year=" . date("Y") . "&month=" . date("m") . "' />"; } $alt_menu = getAddButton() . ButtonView::render(new ButtonModel(IconView::render(new IconModel('arrows-ccw', 'Recurring')), 'recurring.php', 'recurring')); $addModel = new AddModel('Add', 'add_budget_item', 'receipt.php'); $addModel->addRow('store', 'Store'); $addModel->addRadioOption('dateOption-current', 'CURRENT_TIMESTAMP', 'dateOption', 'checked="checked"'); $addModel->addRadioOption('dateOption-selectTime', 'Date/Time', 'dateOption'); $addModel->addRow('selectTime-date', 'Date', '', 'YYYY-MM-DD'); $addModel->addRow('selectTime-time', 'Time', '', 'HH:MM:SS'); // build recurring table model $recurringModel = new TableModel('Recurring items', 'recurring'); $recurringModel->addRow(array(TableView2::createCell('amount', 'Amount', 'th'), TableView2::createCell('category', 'Category', 'th'), TableView2::createCell('store', 'Store', 'th'), TableView2::createCell('items', 'Items', 'th'))); $recurring_items_data = BudgetManager::getAllRecurringByMonth($year, $month); while (($recurring_items_row = mysql_fetch_array($recurring_items_data)) != null) { $amount = $recurring_items_row['amount']; $category = $recurring_items_row['category']; $recurringModel->addRow(array(TableView2::createCell('amount', format_currency($amount)), TableView2::createCell('category', $category), TableView2::createCell('store', $recurring_items_row['store']), TableView2::createCell('items', $recurring_items_row['items']))); $total_spent += $amount;