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


PHP Book::Singleton方法代码示例

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


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

示例1: prepareView

function prepareView($p_variables, &$p_form)
{
    $v_accounts = NULL;
    try {
        $v_accounts = Book::Singleton()->getAccountsForStatement();
    } catch (Exception $v_exception) {
        Cloudbank::PushError(Book::XtractMessage($v_exception));
    }
    $v_template = NULL;
    $p_form = NULL;
    switch (is_null($v_accounts) || count($v_accounts) == 0 ? 'import' : 'accounts') {
        case 'accounts':
            $v_template = new Horde_Template();
            array_walk($v_accounts, function (&$p_record, $p_key) {
                $p_record['type'] = CloudBankConsts::LedgerAccountType_Account;
            });
            CloudBank::AddLinks($v_accounts, 'events.php', array('ledger_account_id' => 'id', 'ledger_account_type' => 'type'), 'name', 'account_link');
            $v_template->set('accounts', $v_accounts);
            $p_form = preparePurgeForm($p_variables);
            break;
        case 'import':
            $p_form = prepareImportForm($p_variables, $v_dummy);
            break;
    }
    return $v_template;
}
开发者ID:psagi,项目名称:cloudbank,代码行数:26,代码来源:statement.php

示例2: processActions

function processActions(&$p_variables, &$p_form)
{
    /* + create new event (ID is empty)
    	 + just render empty form (set defaults)
    	 + form submitted (call server create, if OK redirect to events view)
    	 + if error, render the form w/ data entered
          + create new event from statement data (ID is empty)
    	 + render the form w/ data got in paramters (adjust is_income, amount)
    	 + form submitted (call server create, if OK redirect to events view)
    	 + if error, render the form w/ data entered
          + modify event (ID is filled)
    	 + render the form w/ data got in paramters (adjust is_income, amount,
    	    populate old_ variables)
    	 + form submitted (call server modify, if OK redirect to events view)
    	 + if error, render the form w/ data entered
       */
    $v_event_id = $p_variables->get('event_id');
    $v_isEdit = !empty($v_event_id);
    if ($p_form->validate($p_variables)) {
        // submitted -> process
        $v_account_id = $p_variables->get('account_id');
        try {
            if ($v_isEdit) {
                Book::Singleton()->modifyEvent($p_variables);
            } else {
                //print "submitted/before createEvent(): " . $p_variables->get('amount');
                Book::Singleton()->createEvent($p_variables);
            }
            header('Location: ' . Horde::url('events.php', true)->add(array('ledger_account_id' => $v_account_id, 'ledger_account_type' => CloudBankConsts::LedgerAccountType_Account), NULL, false));
            exit;
        } catch (Exception $v_exception) {
            Cloudbank::PushError(Book::XtractMessage($v_exception));
        }
        //print "submitted/after create/modifyEvent(): " . $p_variables->get('amount');
    } else {
        $v_isEmpty = !$p_variables->get('date');
        //print "not submitted/before PopulateEventForm():" . $p_variables->get('amount');
        if ($v_isEmpty) {
            setDefaultValues($p_variables);
        } else {
            Book::Singleton()->PopulateEventForm($p_variables);
        }
        //print "not submitted/after PopulateEventForm():" . $p_variables->get('amount');
    }
    return $v_isEdit;
}
开发者ID:psagi,项目名称:cloudbank,代码行数:46,代码来源:event.php

示例3: populateStatementItemsTemplateIf

function populateStatementItemsTemplateIf($p_account_id, $p_accountName)
{
    if (!Book::Singleton()->isThereStatementForAccount($p_account_id)) {
        return NULL;
    }
    $v_statementItems = Book::Singleton()->getUnmatchedStatementItems($p_account_id, $p_accountName);
    CloudBank::AddLinks($v_statementItems, 'event.php', array('date' => 'date', 'description' => 'description_short', 'amount' => 'amount', 'statement_item_id' => 'id', 'account_id' => 'account_id', 'account_type' => 'account_type', 'account_name' => 'account_name'), 'description', 'description_link');
    Book::SortResultSet($v_statementItems, 'date', TRUE);
    $v_clearedOrMatchedBalance = Book::Singleton()->getClearedOrMatchedBalance($p_account_id);
    $v_closingStatementItem = Book::Singleton()->getClosingBalance($p_account_id);
    $v_template = new Horde_Template();
    $v_template->set('match_link', Horde::link(Horde::url('statement_item_match.php')->add(array('account_id' => $p_account_id)), 'Update matching Events with Statement Item ID reference') . 'Match</a>');
    $v_template->set('clear_all_matched_link', Horde::link(Horde::url('clear_all_matched_events.php')->add(array('account_id' => $p_account_id)), 'Clear all matched Events and PURGE corresponding STATEMENT ITEMS') . 'Clear all matched</a>');
    $v_template->set('statement_items', $v_statementItems);
    $v_template->set('cleared_or_matched_balance', Book::FormatAmount($v_clearedOrMatchedBalance));
    $v_template->set('statement_closing', $v_closingStatementItem);
    $v_template->set('amount_left', Book::FormatAmount($v_clearedOrMatchedBalance - $v_closingStatementItem['amount']));
    //var_dump($v_template);
    return $v_template;
}
开发者ID:psagi,项目名称:cloudbank,代码行数:20,代码来源:events.php

示例4: header

<?php

/**
 * $Id: delete_event.php,v 1.1 2010/10/24 17:24:39 pety Exp pety $
 *
 * Copyright 2007-2009 The Horde Project (http://www.horde.org/)
 *
 * See the enclosed file COPYING for license information (GPL). If you
 * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
 *
 * @author Peter Sagi <psagi@freemail.hu>
 */
require_once __DIR__ . '/lib/Application.php';
Horde_Registry::appInit('cloudbank');
require_once CLOUDBANK_BASE . '/lib/Cloudbank.php';
require_once CLOUDBANK_BASE . '/lib/Book.php';
/* main() */
$g_variables =& Horde_Variables::getDefaultVariables();
$g_account_id = $g_variables->get('account_id');
$g_event_id = $g_variables->get('event_id');
try {
    Book::Singleton()->deleteEvent($g_event_id);
    header('Location: ' . Horde::url('events.php', true)->add(array('ledger_account_id' => $g_account_id, 'ledger_account_type' => CloudBankConsts::LedgerAccountType_Account), NULL, false));
} catch (Exception $v_exception) {
    Cloudbank::PushError(Book::XtractMessage($v_exception));
    $page_output->header();
    $notification->notify(array('listeners' => 'status'));
    $page_output->footer();
}
开发者ID:psagi,项目名称:cloudbank,代码行数:29,代码来源:delete_event.php

示例5: header

$g_form->addHidden('', 'account_type', 'text', false);
$g_form->addHidden('', 'old_name', 'text', false);
if ($g_form->validate($g_variables)) {
    // submitted -> process
    try {
        if ($g_isEdit) {
            if ($g_account_type == CloudBankConsts::LedgerAccountType_Account) {
                Book::Singleton()->modifyAccount($g_variables);
            } else {
                Book::Singleton()->modifyCategory($g_variables);
            }
        } else {
            if ($g_account_type == CloudBankConsts::LedgerAccountType_Account) {
                Book::Singleton()->createAccount($g_variables);
            } else {
                Book::Singleton()->createCategory($g_variables);
            }
        }
        header('Location: ' . Horde::url($g_account_type == CloudBankConsts::LedgerAccountType_Account ? 'accounts.php' : 'categories.php'), true);
        exit;
    } catch (Exception $v_exception) {
        Cloudbank::PushError(Book::XtractMessage($v_exception));
        $g_isRetry = TRUE;
    }
}
// render
if ($g_isEdit && !$g_isRetry) {
    Book::PopulateAccountForm($g_variables);
}
$title = ($g_isEdit ? 'Edit' : 'Add') . ' ' . $g_objectName;
$page_output->header();
开发者ID:psagi,项目名称:cloudbank,代码行数:31,代码来源:account_or_category.php

示例6: header

<?php

/**
 * $Id: delete_account.php,v 1.2 2010/11/02 21:51:59 pety Exp pety $
 *
 * Copyright 2007-2009 The Horde Project (http://www.horde.org/)
 *
 * See the enclosed file COPYING for license information (GPL). If you
 * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
 *
 * @author Peter Sagi <psagi@freemail.hu>
 */
require_once __DIR__ . '/lib/Application.php';
Horde_Registry::appInit('cloudbank');
require_once CLOUDBANK_BASE . '/lib/Cloudbank.php';
require_once CLOUDBANK_BASE . '/lib/Book.php';
/* main() */
$g_variables =& Horde_Variables::getDefaultVariables();
$g_account_id = $g_variables->get('account_id');
$g_account_type = $g_variables->get('account_type');
try {
    Book::Singleton()->deleteAccount($g_account_id);
    header('Location: ' . Horde::url($g_account_type == CloudBankConsts::LedgerAccountType_Account ? 'accounts.php' : 'categories.php', true));
} catch (Exception $v_exception) {
    Cloudbank::PushError(Book::XtractMessage($v_exception));
    $page_output->header();
    $notification->notify(array('listeners' => 'status'));
    $page_output->footer();
}
开发者ID:psagi,项目名称:cloudbank,代码行数:29,代码来源:delete_account.php

示例7: header

<?php

/**
 * $Id: delete_event.php,v 1.1 2010/10/24 17:24:39 pety Exp pety $
 *
 * Copyright 2007-2009 The Horde Project (http://www.horde.org/)
 *
 * See the enclosed file COPYING for license information (GPL). If you
 * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
 *
 * @author Peter Sagi <psagi@freemail.hu>
 */
require_once __DIR__ . '/lib/Application.php';
Horde_Registry::appInit('cloudbank');
require_once CLOUDBANK_BASE . '/lib/Cloudbank.php';
require_once CLOUDBANK_BASE . '/lib/Book.php';
/* main() */
$g_variables =& Horde_Variables::getDefaultVariables();
$g_account_id = $g_variables->get('account_id');
try {
    Book::Singleton()->matchStatementItems($g_account_id);
    header('Location: ' . Horde::url('events.php', true)->add(array('ledger_account_id' => $g_account_id, 'ledger_account_type' => CloudBankConsts::LedgerAccountType_Account), NULL, false));
} catch (Exception $v_exception) {
    Cloudbank::PushError(Book::XtractMessage($v_exception));
    $page_output->header();
    $notification->notify(array('listeners' => 'status'));
    $page_output->footer();
}
开发者ID:psagi,项目名称:cloudbank,代码行数:28,代码来源:statement_item_match.php

示例8: header

<?php

/**
 * $Id: delete_event.php,v 1.1 2010/10/24 17:24:39 pety Exp pety $
 *
 * Copyright 2007-2009 The Horde Project (http://www.horde.org/)
 *
 * See the enclosed file COPYING for license information (GPL). If you
 * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
 *
 * @author Peter Sagi <psagi@freemail.hu>
 */
require_once __DIR__ . '/lib/Application.php';
Horde_Registry::appInit('cloudbank');
require_once CLOUDBANK_BASE . '/lib/Cloudbank.php';
require_once CLOUDBANK_BASE . '/lib/Book.php';
/* main() */
$g_variables =& Horde_Variables::getDefaultVariables();
$g_account_id = $g_variables->get('account_id');
try {
    Book::Singleton()->clearAllMatchedEvents($g_account_id);
    header('Location: ' . Horde::url('events.php', true)->add(array('ledger_account_id' => $g_account_id, 'ledger_account_type' => CloudBankConsts::LedgerAccountType_Account), NULL, false));
} catch (Exception $v_exception) {
    Cloudbank::PushError(Book::XtractMessage($v_exception));
    $page_output->header();
    $notification->notify(array('listeners' => 'status'));
    $page_output->footer();
}
开发者ID:psagi,项目名称:cloudbank,代码行数:28,代码来源:clear_all_matched_events.php

示例9: dirname

@define('CLOUDBANK_BASE', dirname(__FILE__));
require_once CLOUDBANK_BASE . '/lib/Cloudbank.php';
require_once CLOUDBANK_BASE . '/lib/Book.php';
/* main() */
$g_isError = FALSE;
try {
    $g_accountsOrCategories = Book::Singleton()->getAccountsOrCategoriesWBalance($g_account_type);
    CloudBank::AddLinks($g_accountsOrCategories, 'events.php', array('ledger_account_id' => 'id', 'ledger_account_type' => 'type'), 'name', 'account_link');
    if ($g_account_type == CloudBankConsts::LedgerAccountType_Account) {
        CloudBank::AddLinks($g_accountsOrCategories, 'account_or_category.php', array('account_id' => 'id', 'name' => 'name', 'account_type' => 'type', 'beginning_balance' => 'beginning_balance'), 'edit_icon', 'edit_icon_link', NULL, 'Edit');
    } else {
        CloudBank::AddLinks($g_accountsOrCategories, 'account_or_category.php', array('account_id' => 'id', 'name' => 'name', 'account_type' => 'type'), 'edit_icon', 'edit_icon_link', NULL, 'Edit');
    }
    CloudBank::AddLinks($g_accountsOrCategories, 'delete_account.php', array('account_id' => 'id', 'account_type' => 'type'), 'delete_icon', 'delete_icon_link', NULL, 'Delete');
    Book::SortResultSet($g_accountsOrCategories, 'name');
    $g_total = $g_account_type == CloudBankConsts::LedgerAccountType_Account ? Book::Singleton()->getAccountsTotal() : Book::Singleton()->getCategoriesTotal();
    $g_template = new Horde_Template();
    $g_template->set('new_account_link', Horde::link(Horde::url('account_or_category.php')->add(array('account_type' => $g_account_type))) . 'New</a>');
    $g_template->set('accounts', $g_accountsOrCategories);
    $g_template->set('total', $g_total);
    $title = _($g_account_type == CloudBankConsts::LedgerAccountType_Account ? "Accounts" : "Categories");
} catch (Exception $v_exception) {
    Cloudbank::PushError(Book::XtractMessage($v_exception));
    $g_isError = TRUE;
}
$page_output->header();
$notification->notify(array('listeners' => 'status'));
if (!$g_isError) {
    //$g_template->setOption('debug', true);
    echo $g_template->fetch(CLOUDBANK_TEMPLATES . '/accounts.html');
}
开发者ID:psagi,项目名称:cloudbank,代码行数:31,代码来源:accounts_or_categories.php


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