当前位置: 首页>>代码示例>>PHP>>正文


PHP Factory::createView方法代码示例

本文整理汇总了PHP中Factory::createView方法的典型用法代码示例。如果您正苦于以下问题:PHP Factory::createView方法的具体用法?PHP Factory::createView怎么用?PHP Factory::createView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Factory的用法示例。


在下文中一共展示了Factory::createView方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Exception

             $transaction->commit();
             break;
         case 'remove':
             if (!array_key_exists('id', $_REQUEST) || !trim($_REQUEST['id'])) {
                 throw new Exception("Missing required parameter transaction id");
             }
             $transaction = new Transaction(new MySqlDB());
             $transaction->start();
             $activity = Factory::getView(new ActivityKey($_REQUEST['id']));
             $activity->requestDelete();
             $transaction->commit();
             break;
         case 'create':
             $transaction = new Transaction(new MySqlDB());
             $transaction->start();
             $activity = Factory::createView(new ActivityKey());
             $activity->setUser($user);
             $activity->setImportNumber(-1);
             $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);
开发者ID:kieubinh,项目名称:cs679-b1-class-project,代码行数:31,代码来源:transactions.php

示例2: isset

            }
            $transactionDateCol = isset($_REQUEST['transactionDate']) ? htmlentities($_REQUEST['transactionDate']) : false;
            if ($transactionDateCol === false) {
                throw new Exception('Missing required parameter transaction date column');
            }
            $descriptionCol = isset($_REQUEST['description']) ? htmlentities($_REQUEST['description']) : false;
            if ($descriptionCol === false) {
                throw new Exception('Missing required parameter description column');
            }
            $amountCol = isset($_REQUEST['amount']) ? htmlentities($_REQUEST['amount']) : false;
            if ($amountCol === false) {
                throw new Exception('Missing required parameter amount column');
            }
            $transaction = new Transaction(new MySqlDB());
            $transaction->start();
            $mapping = Factory::createView(new MappingKey());
            $mapping->setUser($user);
            $mapping->setStartingRow($startingRow);
            $mapping->setName($name);
            $mapping->addMappingDetail(new MappingDetail($mapping, MappingDetail::$MAPPING_TRANSACTION_DATE, $transactionDateCol));
            $mapping->addMappingDetail(new MappingDetail($mapping, MappingDetail::$MAPPING_AMOUNT, $amountCol));
            $mapping->addMappingDetail(new MappingDetail($mapping, MappingDetail::$MAPPING_NAME, $descriptionCol));
            $transaction->commit();
        } else {
            $smarty = new MySmarty($SMARTY_CONFIG);
            $smarty->assign('user', $user);
            $smarty->assign('left_menu', true);
            $smarty->display('custommapping.tpl');
        }
    }
} catch (AccessDeniedException $e) {
开发者ID:kieubinh,项目名称:cs679-b1-class-project,代码行数:31,代码来源:custommapping.php

示例3: Access

try {
    $fullPage = true;
    $access = new Access();
    $access->authenticate();
    $user = $access->getUser();
    $smarty = new MySmarty($SMARTY_CONFIG);
    if (!empty($_POST)) {
        $fullPage = false;
        $action = htmlentities($_POST['action']);
        if ($action === "add") {
            $categoryId = htmlentities($_POST['categoryId']);
            //TODO: check amount is valid
            $budgetedAmount = htmlentities($_POST['budgetedAmount']);
            $transaction = new Transaction(new MySqlDB());
            $transaction->start();
            $budget = Factory::createView(new BudgetKey());
            $category = Factory::getView(new CategoryKey($categoryId));
            $budget->setUser($user);
            $budget->setActive(TRUE);
            $budget->setAmount($budgetedAmount);
            $budget->setCategory($category);
            $transaction->commit();
        } elseif ($action === "remove") {
            $key = htmlentities($_POST['key']);
            $transaction = new Transaction(new MySqlDB());
            $transaction->start();
            $budgetItem = Factory::getView(new BudgetKey($key));
            $budgetItem->setActive(0);
            $transaction->commit();
        }
    }
开发者ID:kieubinh,项目名称:cs679-b1-class-project,代码行数:31,代码来源:budget.php

示例4: Transaction

     $smarty->display('error.tpl');
     return;
 }
 //check username is email
 if (!preg_match("/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}\$/i", $username)) {
     $smarty->display('error.tpl');
     return;
 }
 //check password meets standards
 if (!preg_match("/((?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[^a-zA-Z0-9\\s]).{8,})/", $password)) {
     $smarty->display('error.tpl');
     return;
 }
 $transaction = new Transaction(new MySqlDB());
 $transaction->start();
 $user = Factory::createView(new UserKey());
 $date = new Date();
 $user->setUsername($username);
 $user->setPassword($password);
 $user->setActive(true);
 $user->setCreatedDate($date->getTimestamp());
 $user->setLastLoginDate($date->getTimestamp());
 $user->setNumberOfAttempts(1);
 $user->setFirstName($firstname);
 $user->setLastName($lastname);
 $transaction->commit();
 $access = new Access();
 if ($access->authenticate($username, $password)) {
     header("Location: dashboard.php");
     exit;
 } else {
开发者ID:kieubinh,项目名称:cs679-b1-class-project,代码行数:31,代码来源:register.php

示例5: isset

if (isset($_POST['submit'])) {
    try {
        $name = isset($_REQUEST['name']) ? htmlentities($_REQUEST['name']) : false;
        $email = isset($_REQUEST['email']) && preg_match("/^[_a-z0-9]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,3})\$/i", $_REQUEST['email']) ? htmlentities($_REQUEST['email']) : false;
        $message = isset($_REQUEST['message']) ? htmlentities($_REQUEST['message']) : false;
        // inserting into table contact
        $transaction = new Transaction(new MySqlDB());
        $transaction->start();
        if (!$user) {
            // User is not logged in, so trying to find user by his provided email
            $temp = User::getUserByUserName($email);
            if ($temp !== null) {
                $user = $temp;
            }
        }
        $contact = Factory::createView(new ContactKey());
        if ($user) {
            $contact->setUser($user);
        }
        $contact->setName($name);
        $contact->setEmail($email);
        $contact->setContent($message);
        $contact->setDateSubmitted(new Date());
        $transaction->commit();
        $smarty->assign('message', 'Message sent to iBudget successfully.');
    } catch (Exception $e) {
        if ($transaction && !$transaction->isComplete()) {
            $transaction->rollBack();
        }
        $smarty->assign('message', 'An error had occurred, please try again in a few minutes.');
        // echo "<PRE>A error had occured: " . $e->getMessage() . "\n" . $e->getTraceAsString() . "\n</PRE>";
开发者ID:kieubinh,项目名称:cs679-b1-class-project,代码行数:31,代码来源:contact.php

示例6: Access

require_once 'activity.inc';
require_once 'date.inc';
try {
    $fullPage = true;
    $access = new Access();
    $access->authenticate();
    $user = $access->getUser();
    $smarty = new MySmarty($SMARTY_CONFIG);
    if (!empty($_POST)) {
        $fullPage = false;
        $action = htmlentities($_POST['action']);
        if ($action === "add") {
            $categoryName = htmlentities($_POST['categoryName']);
            $transaction = new Transaction(new MySqlDB());
            $transaction->start();
            $category = Factory::createView(new CategoryKey());
            $category->setUser($user);
            $category->setActive(TRUE);
            $category->setName($categoryName);
            $transaction->commit();
        } elseif ($action === "remove") {
            try {
                $key = htmlentities($_POST['key']);
                $transaction = new Transaction(new MySqlDB());
                $transaction->start();
                $categoryItem = Factory::getView(new CategoryKey($key));
                $categoryItem->setActive(0);
                $transaction->commit();
            } catch (Exception $e) {
                print_r($e);
            }
开发者ID:kieubinh,项目名称:cs679-b1-class-project,代码行数:31,代码来源:category.php


注:本文中的Factory::createView方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。