$activity->setImportTime(new Date()); $activity->setName($data['name']); $activity->setTransactionDate(new Date($_POST['data']['transdate'])); $activity->setAmount($data['amount']); if ($data['category'] != null && trim($data['category']) && $data['category'] != 'null') { $activity->setCategory(Factory::getView(new CategoryKey(trim($data['category'])))); } $transaction->commit(); break; } echo json_encode(array('success' => 'true')); } else { $smarty = new MySmarty($SMARTY_CONFIG); $smarty->assign('res', $user->getActivities()); $userCategories = Category::getOptions(array("USER_ID" => $user->getId(), "ACTIVE" => 1)); $allCategories = Category::getOptions(array("ACTIVE" => 1)); $categories = ''; foreach ($userCategories as $index => $value) { $categories .= "{\"value\": \"{$index}\", \"label\": \"{$value}\"},"; } $smarty->assign('allCategories', $categories); $smarty->assign('user', $user); $smarty->assign('left_menu', true); //$smarty->assign('BASE_URL', $BASE_URL); $smarty->display('transactions.tpl'); } } catch (AccessDeniedException $e) { header('HTTP/1.1 401 Access Denied'); echo "AccessDeniedException: " . $e->getMessage(); } catch (Exception $e) { if ($transaction && !$transaction->isComplete()) {
<?php $html = ''; $category = new Category(); $html_CategoryOptions = $category->getOptions(); if (strcasecmp('get-map-content', $_POST['method']) == 0 || empty($_POST['method'])) { $html = <<<HTML \t\t\t<div id="map"></div> HTML; } else { if (strcasecmp('get-form-create-place', $_POST['method']) == 0) { $html = <<<HTML \t\t\t<form id="form-create-place"> \t\t\t\t<input type="text" id="fo-name" placeholder="*Nome" maxlength="50"> \t\t\t\t<select id="fo-category"> \t\t\t\t\t{$html_CategoryOptions} \t\t\t\t</select> \t\t\t\t<label> \t\t\t\t\t<input type="checkbox" id="fo-status" checked="checked"> \t\t\t\t\tAtivo \t\t\t\t</label> \t\t\t\t<br><br> \t\t\t\t<textarea id="fo-description" placeholder="*Descrição"></textarea> \t\t\t\t<input type="hidden" id="fo-latitude" value="-20.200404"> \t\t\t\t<input type="hidden" id="fo-longitude" value="-40.228925"> \t\t\t \t\t\t\t<input type="text" id="map-search" placeholder="Buscar no Mapa">