コード例 #1
0
ファイル: form.class.php プロジェクト: bmiro/speedcard
 /**
  * Render and output the form HTML code.
  */
 public function render()
 {
     $output = '';
     /**
      * Get each field. Print them in order, based on 'weight'.
      */
     ksort($this->form);
     foreach ($this->form as $group) {
         foreach ($group as $field => $options) {
             $fields_output .= $this->render_field($field, $options);
         }
     }
     /**
      * Set the propierties for the form.
      */
     $enctype = $this->prop['enctype'] ? ' enctype=' . $this->prop['enctype'] : '';
     $method = $this->prop['method'] ? $this->prop['method'] : 'POST';
     $output .= '<form action="' . $this->prop['path'] . '" method="' . $method . '" id="' . $this->prop['formid'] . '"' . $enctype . ' class="form">';
     if ($this->prop['title']) {
         page_set_title($this->prop['title']);
     }
     if ($this->prop['desc']) {
         $output .= '<p class="text bold">' . $this->prop['desc'] . '</p>';
     }
     if ($this->prop['mandatory_msg']) {
         $output .= '<p class="text marginbot15">' . t('Fields marked as <span class="required">*</span> are compulsory.') . '</p>';
     }
     $output .= $fields_output;
     $output .= '</form>';
     return $output;
 }
コード例 #2
0
ファイル: speedcard.php プロジェクト: bmiro/speedcard
function controller($args)
{
    $ucard = random_card();
    $card_name = t(ucard2words($ucard));
    $card_icon = ucard2html($ucard);
    $card_suit = ucard2suit($ucard);
    page_set_title("{$card_icon} {$card_name}");
    $tpl_params = ['card_name' => $card_name, 'card_icon' => $card_icon, 'card_suit' => $card_suit];
    $tpl = new Template();
    $tpl->add('main', 'blocks/speedcard', $tpl_params);
    $tpl->setTPL('page');
    return $tpl->render();
}
コード例 #3
0
ファイル: m_articles.php プロジェクト: VeronikaYarats/teashop
function m_articles($argv = array())
{
    $tpl = new strontium_tpl("private/tpl/m_articles.html", array(), false);
    if (isset($argv['id'])) {
        $article = article_get_by_id($argv['id']);
    } else {
        if (isset($argv['key'])) {
            $article = article_get_by_key($argv['key']);
        } else {
            $article = article_get_by_key("welcome");
        }
    }
    if ($article < 0) {
        $tpl->assign("article_error_message");
    } else {
        $tpl->assign("article", $article);
    }
    page_set_title($article['page_title']);
    return $tpl->result();
}
コード例 #4
0
ファイル: page.inc.php プロジェクト: mehulsbhatt/seltzer
/**
 * Page hook.  Adds member module content to a page before it is rendered.
 *
 * @param &$page_data Reference to data about the page being rendered.
 * @param $page_name The name of the page being rendered.
 * @param $options The array of options passed to theme('page').
*/
function core_page(&$page_data, $page_name, $options)
{
    switch ($page_name) {
        case '<front>':
            page_add_content_top($page_data, '<p>Welcome to SeltzerCRM!</p>');
            break;
        case 'install':
            page_add_content_top($page_data, theme('form', module_install_form()));
            break;
        case 'login':
            page_add_content_top($page_data, theme('login_form'));
            break;
        case 'reset':
            page_add_content_top($page_data, theme('user_reset_password_form'));
            break;
        case 'reset-confirm':
            page_add_content_top($page_data, theme('user_reset_password_confirm_form', $_GET['v']));
            break;
        case 'delete':
            page_add_content_top($page_data, theme('delete_form', $_GET['type'], $_GET['id']));
            break;
        case 'reports':
            if (user_access('report_view')) {
                page_set_title($page_data, 'Reports');
            }
            break;
        case 'permissions':
            if (user_access('user_permissions_edit')) {
                page_set_title($page_data, 'Permissions');
                page_add_content_top($page_data, theme('form', user_permissions_form()));
            }
            break;
        case 'upgrade':
            if (user_access('module_upgrade')) {
                page_set_title($page_data, 'Upgrade Modules');
                $content = theme('table', 'module_upgrade');
                $content .= theme('form', module_upgrade_form());
                page_add_content_top($page_data, $content);
            }
    }
}
コード例 #5
0
ファイル: page.inc.php プロジェクト: mehulsbhatt/seltzer
/**
 * Page hook.  Adds member module content to a page before it is rendered.
 *
 * @param &$page_data Reference to data about the page being rendered.
 * @param $page_name The name of the page being rendered.
 * @param $options The array of options passed to theme('page').
*/
function member_page(&$page_data, $page_name, $options)
{
    switch ($page_name) {
        case 'members':
            // Set page title
            page_set_title($page_data, 'Members');
            // Add view tab
            if (user_access('member_view')) {
                $view = theme('member_filter_form');
                $opts = array('filter' => $_SESSION['member_filter'], 'show_export' => true, 'exclude' => array('emergencyName', 'emergencyPhone'));
                $view .= theme('table', 'member', $opts);
                page_add_content_top($page_data, $view, 'View');
            }
            // Add add tab
            if (user_access('member_add')) {
                page_add_content_top($page_data, theme('form', crm_get_form('member_add')), 'Add');
            }
            // Add import tab
            if (user_access('contact_edit') && user_access('member_edit')) {
                page_add_content_top($page_data, theme('form', member_import_form()), 'Import');
            }
            break;
        case 'plans':
            // Set page title
            page_set_title($page_data, 'Plans');
            // Add view, add and import tabs
            if (user_access('member_plan_edit')) {
                page_add_content_top($page_data, theme('table', 'member_plan'), 'View');
                page_add_content_top($page_data, theme('member_plan_add_form'), 'Add');
                page_add_content_top($page_data, theme('form', plan_import_form()), 'Import');
            }
            break;
        case 'plan':
            // Capture plan id
            $pid = $_GET['pid'];
            if (empty($pid)) {
                return;
            }
            // Set page title
            page_set_title($page_data, 'Plan: ' . theme('member_plan_description', $pid));
            // Add edit tab
            if (user_access('member_plan_edit')) {
                page_add_content_top($page_data, theme('member_plan_edit_form', $pid), 'Edit');
            }
            break;
        case 'contact':
            // Capture member id
            $cid = $_GET['cid'];
            if (empty($cid)) {
                return;
            }
            // Add plan and role tabs
            if (user_access('member_membership_edit') || $cid == user_id()) {
                $plan = theme('table', 'member_membership', array('cid' => $cid));
                $plan .= theme('member_membership_add_form', $cid);
                page_add_content_top($page_data, $plan, 'Plan');
            }
            if (user_access('member_membership_edit')) {
                $roles = theme('user_role_edit_form', $cid);
                page_add_content_top($page_data, $roles, 'Roles');
            }
            break;
        case 'membership':
            // Capture sid id
            $sid = $_GET['sid'];
            if (empty($sid)) {
                return;
            }
            // Set page title
            page_set_title($page_data, member_membership_description($sid));
            // Add edit tab
            if (user_access('member_membership_edit') && user_access('member_edit')) {
                page_add_content_top($page_data, theme('member_membership_edit_form', $sid), 'Edit');
            }
            break;
        case 'reports':
            if (user_access('member_view')) {
                $reports = theme('member_membership_report');
                $reports .= theme('member_email_report', array('filter' => array('active' => true)));
                $reports .= theme('member_email_report', array('filter' => array('active' => false)));
                //$reports .= theme('member_voting_report');
                page_add_content_bottom($page_data, $reports);
            }
            break;
    }
}
コード例 #6
0
/**
 * Page hook.  Adds module content to a page before it is rendered.
 *
 * @param &$page_data Reference to data about the page being rendered.
 * @param $page_name The name of the page being rendered.
 * @param $options The array of options passed to theme('page').
*/
function secrets_page(&$page_data, $page_name, $options)
{
    switch ($page_name) {
        case 'secrets':
            page_set_title($page_data, 'Secret Keeper');
            if (user_access('secrets_view')) {
                $secrets = theme('table', 'secrets', array('show_export' => true));
            }
            if (user_access('secrets_edit')) {
                $secrets .= theme('secrets_add_form', '');
            }
            page_add_content_top($page_data, $secrets);
            break;
        case 'secrets_edit':
            // Capture secret to edit
            $name = $options['name'];
            if (empty($name)) {
                return;
            }
            page_set_title($page_data, 'Edit a Secret');
            if (user_access('secrets_edit')) {
                page_add_content_top($page_data, theme('secrets_edit_form', $name));
            }
            break;
    }
}
コード例 #7
0
ファイル: key.inc.php プロジェクト: mehulsbhatt/seltzer
/**
 * Page hook.  Adds module content to a page before it is rendered.
 *
 * @param &$page_data Reference to data about the page being rendered.
 * @param $page_name The name of the page being rendered.
 * @param $options The array of options passed to theme('page').
*/
function key_page(&$page_data, $page_name, $options)
{
    switch ($page_name) {
        case 'contact':
            // Capture contact cid
            $cid = $options['cid'];
            if (empty($cid)) {
                return;
            }
            // Add keys tab
            if (user_access('key_view') || user_access('key_edit') || user_access('key_delete') || $cid == user_id()) {
                $keys = theme('table', 'key', array('cid' => $cid));
                $keys .= theme('key_add_form', $cid);
                page_add_content_bottom($page_data, $keys, 'Keys');
            }
            break;
        case 'keys':
            page_set_title($page_data, 'Keys');
            if (user_access('key_view')) {
                $keys = theme('table', 'key', array('join' => array('contact', 'member'), 'show_export' => true));
                page_add_content_top($page_data, $keys, 'View');
            }
            break;
        case 'key':
            // Capture key id
            $kid = $options['kid'];
            if (empty($kid)) {
                return;
            }
            // Set page title
            page_set_title($page_data, key_description($kid));
            // Add edit tab
            if (user_access('key_view') || user_access('key_edit') || user_access('key_delete')) {
                page_add_content_top($page_data, theme('key_edit_form', $kid), 'Edit');
            }
            break;
    }
}
コード例 #8
0
/**
 * Page hook.  Adds module content to a page before it is rendered.
 *
 * @param &$page_data Reference to data about the page being rendered.
 * @param $page_name The name of the page being rendered.
 * @param $options The array of options passed to theme('page').
*/
function amazon_payment_page(&$page_data, $page_name, $options)
{
    switch ($page_name) {
        case 'payments':
            if (user_access('payment_edit')) {
                $content = theme('amazon_payment_admin');
                $content .= theme('form', crm_get_form('amazon_payment_import'));
                page_add_content_top($page_data, $content, 'Amazon');
                if (function_exists('billing_revision')) {
                    page_add_content_top($page_data, theme('form', crm_get_form('amazon_payment_email_bills')), 'Billing');
                }
            }
            break;
        case 'amazon-admin':
            page_set_title($page_data, 'Administer Amazon Contacts');
            page_add_content_top($page_data, theme('table', 'amazon_payment_contact', array('show_export' => true)), 'View');
            page_add_content_top($page_data, theme('form', crm_get_form('amazon_payment_contact_add')), 'Add');
            break;
        case 'contact':
            if (user_access('payment_view') || $_GET['cid'] == user_id()) {
                page_add_content_bottom($page_data, theme('amazon_payment_account_info', $_GET['cid']), 'Account');
            }
            if (function_exists('billing_revision')) {
                if (user_access('payment_view') || $_GET['cid'] == user_id()) {
                    page_add_content_bottom($page_data, theme('amazon_payment_first_month', $_GET['cid']), 'Plan');
                }
            }
            break;
    }
}
コード例 #9
0
ファイル: payment.inc.php プロジェクト: mehulsbhatt/seltzer
/**
 * Page hook.  Adds module content to a page before it is rendered.
 *
 * @param &$page_data Reference to data about the page being rendered.
 * @param $page_name The name of the page being rendered.
 * @param $options The array of options passed to theme('page').
*/
function payment_page(&$page_data, $page_name, $options)
{
    switch ($page_name) {
        case 'payments':
            page_set_title($page_data, 'Payments');
            if (user_access('payment_edit')) {
                $filter = array_key_exists('payment_filter', $_SESSION) ? $_SESSION['payment_filter'] : '';
                $content = theme('form', crm_get_form('payment_add'));
                $content .= theme('form', crm_get_form('payment_filter'));
                $opts = array('show_export' => true, 'filter' => $filter);
                $content .= theme('table', 'payment', $opts);
                page_add_content_top($page_data, $content, 'View');
            }
            break;
        case 'payment':
            page_set_title($page_data, 'Payment');
            if (user_access('payment_edit')) {
                $content = theme('form', crm_get_form('payment_edit', $_GET['pmtid']));
                page_add_content_top($page_data, $content);
            }
            break;
        case 'accounts':
            page_set_title($page_data, 'Accounts');
            if (user_access('payment_view')) {
                $content = theme('table', 'payment_accounts', array('show_export' => true));
                page_add_content_top($page_data, $content);
            }
            break;
        case 'contact':
            if (user_id() == $_GET['cid'] || user_access('payment_view')) {
                $content = theme('table', 'payment_history', array('cid' => $_GET['cid']));
                page_add_content_top($page_data, $content, 'Account');
            }
            break;
    }
}
コード例 #10
0
/**
 * Page hook.  Adds module content to a page before it is rendered.
 *
 * @param &$page_data Reference to data about the page being rendered.
 * @param $page_name The name of the page being rendered.
 * @param $options The array of options passed to theme('page').
*/
function paypal_payment_page(&$page_data, $page_name, $options)
{
    switch ($page_name) {
        case 'payments':
            if (user_access('payment_edit')) {
                $content = theme('paypal_payment_admin');
                $content .= theme('form', crm_get_form('paypal_payment_import'));
                page_add_content_top($page_data, $content, 'Paypal');
            }
            break;
        case 'paypal-admin':
            page_set_title($page_data, 'Administer Paypal Contacts');
            page_add_content_top($page_data, theme('table', 'paypal_payment_contact', array('show_export' => true)), 'View');
            page_add_content_top($page_data, theme('form', crm_get_form('paypal_payment_contact_add')), 'Add');
            break;
    }
}
コード例 #11
0
ファイル: contact.inc.php プロジェクト: mehulsbhatt/seltzer
/**
 * Page hook.  Adds contact module content to a page before it is rendered.
 *
 * @param &$page_data Reference to data about the page being rendered.
 * @param $page_name The name of the page being rendered.
*/
function contact_page(&$page_data, $page_name)
{
    switch ($page_name) {
        case 'contacts':
            // Set page title
            page_set_title($page_data, 'Contacts');
            // Add view tab
            if (user_access('contact_view')) {
                $opts = array('show_export' => true, 'exclude' => array('emergencyName', 'emergencyPhone'));
                $view = theme('table', 'contact', $opts);
                page_add_content_top($page_data, $view, 'View');
            }
            // Add add tab
            if (user_access('contact_add')) {
                page_add_content_top($page_data, theme('form', crm_get_form('contact')), 'Add');
            }
            break;
        case 'contact':
            // Capture contact id
            $cid = $_GET['cid'];
            if (empty($cid)) {
                return;
            }
            if (!user_access('contact_view') && $cid !== user_id()) {
                error_register('Permission denied: contact_view');
                return;
            }
            $contact_data = crm_get_data('contact', array('cid' => $cid));
            $contact = $contact_data[0];
            // Set page title
            page_set_title($page_data, theme('contact_name', $contact));
            // Add view tab
            $view_content = '';
            if (user_access('contact_view')) {
                $view_content .= '<h3>Contact Info</h3>';
                $opts = array('cid' => $cid, 'ops' => false);
                $view_content .= theme('table_vertical', 'contact', array('cid' => $cid));
            }
            if (!empty($view_content)) {
                page_add_content_top($page_data, $view_content, 'View');
            }
            // Add edit tab
            if (user_access('contact_edit') || $cid == user_id()) {
                $opts = array('cid' => $cid);
                $form = crm_get_form('contact', $opts);
                page_add_content_top($page_data, theme('form', $form), 'Edit');
            }
            break;
    }
}