コード例 #1
1
ファイル: index_i.php プロジェクト: uirapuru/virgoapi
function ShowSearchForm(VirgoAPI $api, Smarty $smarty, $lng)
{
    $smarty->assign("ShowSearchForm", true);
    $smarty->assign("provinces", $api->GetInvestmentsProvinces($lng));
    $smarty->assign("categories", $api->GetInvestmentsCategories($lng));
    $smarty->assign("post", $_POST);
}
コード例 #2
0
 public function generateSql()
 {
     $namespace = \Zule\Tools\Config::zc()->framework->application_namespace;
     $system = 'Zule';
     $tables = $this->settings->getTables();
     foreach ($tables as $table) {
         $s = new \Smarty();
         $tableName = $table->getName();
         // generate model
         $s->assign('model_name', $_POST["class_{$tableName}"]);
         $s->assign('namespace', $namespace);
         $s->assign('system', $system);
         $s->assign('class_name', $_POST["class_{$tableName}"]);
         $s->assign('extend_path', '\\Zule\\Models\\Model');
         $s->assign('impl_date', date('Y-m-d H:i:s'));
         $s->assign('use_unsafe_setters', 0);
         $s->assign('table_name', $tableName);
         $columns = $table->getColumns();
         $s->assign('columns', $columns);
         $s->assign('primary_key', $table->getPrimaryKey());
         $gen = new Generator("../models/" . $_POST["class_{$tableName}"] . '.php');
         $gen->generate($s, 'model_sql');
         $gen = new Generator("../models/Data/" . $_POST["class_{$tableName}"] . '.php');
         $gen->generate($s, 'gateway_sql');
     }
 }
コード例 #3
0
ファイル: Index.php プロジェクト: rx-projects/comicasa
 public function invokeHandler(Smarty $viewModel, $header, $f, $page, User $user)
 {
     $header->meta(array('keywords' => 'Home Meta Keywords', 'description' => 'Home Meta Description'));
     $header->title('RUDRAX');
     $header->import('bootstrap', 'utils', 'product_login', 'utils_tunnel');
     $cahce = new RxCache();
     $page->data->assign('myDataKey', $cahce->get('mykey'));
     $cahce->set('mykey', $cahce->get('mykey') + 1);
     if (isset($_REQUEST['uname'])) {
         $username = $_POST['uname'];
         $password = $_POST['pass'];
         $user->auth($username, $password);
     }
     //Console::log($this->user->getToken(),$username,$password);
     if ($user->isValid()) {
         $viewModel->assign('token', $user->getToken());
         $viewModel->assign('profile', $user->getProfile());
         $viewModel->assign("Name", "Fred Irving Johnathan Bradley Peppergill", true);
         $viewModel->assign("FirstName", array("John", "Mary", "James", "Henry"));
         $viewModel->assign("LastName", array("Doe", "Smith", "Johnson", "Case"));
         $viewModel->assign("Class", array(array("A", "B", "C", "D"), array("E", "F", "G", "H"), array("I", "J", "K", "L"), array("M", "N", "O", "P")));
         $viewModel->assign("contacts", array(array("phone" => "1", "fax" => "2", "cell" => "3"), array("phone" => "555-4444", "fax" => "555-3333", "cell" => "760-1234")));
         $viewModel->assign("option_values", array("NY", "NE", "KS", "IA", "OK", "TX"));
         $viewModel->assign("option_output", array("New York", "Nebraska", "Kansas", "Iowa", "Oklahoma", "Texas"));
         $viewModel->assign("option_selected", "NE");
         return "home/home";
     } else {
         return "sample/login";
     }
 }
コード例 #4
0
 function doResult($objAction, $arrResultParams, $arrData = array(), $objEngine = null)
 {
     require_once SMATY_LIB . 'Smarty.class.php';
     $smarty = new Smarty();
     //����smartyʵ�����$smarty
     $smarty->template_dir = DISK_ROOT . TEMPLATE_DIR;
     //����ģ��Ŀ¼
     $smarty->compile_dir = DISK_ROOT . COMPILE_DIR;
     //���ñ���Ŀ¼
     $smarty->cache_dir = DISK_ROOT . CACHE_DIR;
     //����Ŀ¼
     $smarty->cache_lifetime = CACHE_LIFETIME;
     //����ʱ��
     $smarty->caching = CACHING;
     //���淽ʽ
     $smarty->left_delimiter = LEFT_DELIMITER;
     $smarty->right_delimiter = RIGHT_DELIMITER;
     $arrFunction = get_class_methods($objAction);
     $arrPageInfoData = $objAction->getPageInfo();
     foreach ($arrPageInfoData as $key => $value) {
         $smarty->assign($key, $value);
     }
     $smarty->assign("basePath", DISK_ROOT);
     $smarty->assign("host", HOST);
     $tplPath = $arrResultParams['value'];
     $tplPath = strval($tplPath);
     $smarty->display($tplPath);
 }
コード例 #5
0
 /**
  * @return Smarty
  * @throws CreateReportFileFailedException
  */
 public function execute()
 {
     // Unique Session ID for matching the storage filenames
     // of the report and CSS. Allows for later retrieval.
     // For our purposes, this is random enough (not cryptographically secure, though).
     // We aren't trying to hide any IDs, just trying to avoid collisions.
     $sessionID = uniqid(rand(), true);
     // Validate and read file
     $uploadReader = new CSSFileUploadReader();
     $fileContents = $uploadReader->readFile();
     // Parse file / generate report and write.
     $cssFileParser = new CSSFileParser();
     $reportPayload = $cssFileParser->generateReport($fileContents);
     $reportEncoded = json_encode($reportPayload);
     // Persist. For now, using Amazon since Heroku doesn't have a persistent filesystem.
     $persistenceHelper = new ReportAndCSSPersistence($sessionID);
     $reportURL = $persistenceHelper->persistCSSReport($reportEncoded);
     $cssFilePath = $_FILES['cssfile']['tmp_name'];
     $cssURL = $persistenceHelper->persistUploadedCSSFile($cssFilePath);
     // Assign smarty, return.
     $smarty = new Smarty();
     $smarty->assign('reportURL', $reportURL);
     $smarty->assign('cssURL', $cssURL);
     $smarty->assign('reportPayload', $reportPayload);
     $smarty->assign('sessionID', $sessionID);
     return $smarty;
 }
コード例 #6
0
ファイル: SmartyDynamic.php プロジェクト: alachaum/timetrex
 function _renderForm(&$page)
 {
     $pageName = $page->getAttribute('name');
     $tabPreview = array_slice($page->controller->_tabs, -2, 1);
     // setup a template object
     $tpl = new Smarty();
     $tpl->template_dir = './templates';
     $tpl->compile_dir = './templates_c';
     // on preview tab, add progress bar javascript and stylesheet
     if ($pageName == $tabPreview[0][0]) {
         $bar = $page->controller->createProgressBar();
         $tpl->assign(array('qf_style' => $bar->getStyle(), 'qf_script' => $bar->getScript()));
         $barElement = $page->getElement('progressBar');
         $barElement->setText($bar->toHtml());
     }
     $renderer = new HTML_QuickForm_Renderer_Array(true);
     $page->accept($renderer);
     $tpl->assign('form', $renderer->toArray());
     // capture the array stucture
     // (only for showing in sample template)
     ob_start();
     print_r($renderer->toArray());
     $tpl->assign('dynamic_array', ob_get_contents());
     ob_end_clean();
     $tpl->display('smarty-dynamic.tpl');
 }
コード例 #7
0
ファイル: user.php プロジェクト: adrianshort/planningalerts
 function save($send_confirmation_email = false)
 {
     $db = DB::connect(DB_CONNECTION_STRING);
     //Check if it exists, the do an update or insert
     $exists = false;
     if ($this->user_id != 0) {
         $sql = "select user_id from user where user_id = " . $this->user_id;
         $results = $db->query($sql);
         if (sizeof($results) != 0) {
             $exists = true;
         }
     }
     if (!$exists) {
         $this->add();
     } else {
         $this->update();
     }
     //Send email
     if ($send_confirmation_email == true) {
         $smarty = new Smarty();
         $smarty->force_compile = true;
         $smarty->compile_dir = SMARTY_COMPILE_DIRECTORY;
         $smarty->assign("email", $this->email);
         $smarty->assign("postcode", clean_postcode($this->postcode));
         $smarty->assign("url", BASE_URL . "/confirmed.php?cid=" . $this->confirm_id);
         //Get the email text
         $email_text = $smarty->fetch('confirm_email_text.tpl');
         //Send the email
         send_text_email($this->email, EMAIL_FROM_NAME, EMAIL_FROM_ADDRESS, "Please confirm your planning alert", $email_text);
     }
 }
コード例 #8
0
/**
 * Render pagination block
 * 
 * Parameters:
 * 
 * - page - current_page
 * - total_pages - total pages
 * - route - route for URL assembly
 *
 * @param array $params
 * @param Smarty $smarty
 * @return string
 */
function smarty_function_mobile_access_paginator($params, &$smarty)
{
    $url_params = '';
    if (is_foreachable($params)) {
        foreach ($params as $k => $v) {
            if (strpos($k, 'url_param_') !== false && $v) {
                $url_params .= '&' . substr($k, 10) . '=' . $v;
            }
            // if
        }
        // foreach
    }
    // if
    $paginator = array_var($params, 'paginator', new Pager());
    $paginator_url = array_var($params, 'url', ROOT_URL);
    $paginator_anchor = array_var($params, 'anchor', '');
    $smarty->assign(array("_mobile_access_paginator_url" => $paginator_url, "_mobile_access_paginator" => $paginator, '_mobile_access_paginator_anchor' => $paginator_anchor, "_mobile_access_paginator_url_params" => $url_params));
    $paginator_url = strpos($paginator_url, '?') === false ? $paginator_url . '?' : $paginator_url . '&';
    if (!$paginator->isFirst()) {
        $smarty->assign('_mobile_access_paginator_prev_url', $paginator_url . 'page=' . ($paginator->getCurrentPage() - 1) . $url_params . $paginator_anchor);
    }
    // if
    if (!$paginator->isLast()) {
        $smarty->assign('_mobile_access_paginator_next_url', $paginator_url . 'page=' . ($paginator->getCurrentPage() + 1) . $url_params . $paginator_anchor);
    }
    // if
    return $smarty->fetch(get_template_path('_paginator', null, MOBILE_ACCESS_MODULE));
}
コード例 #9
0
ファイル: Smarty.php プロジェクト: Tony133/zf-web
 /**
  * fetch a template, echos the result,
  *
  * @see Zend_View_Abstract::render()
  * @param string $name the template
  * @return void
  */
 protected function _run()
 {
     $this->strictVars(true);
     //assign variables to the template engine
     $vars = get_object_vars($this);
     foreach ($vars as $key => $value) {
         if ('_' != substr($key, 0, 1)) {
             $this->_smarty->assign($key, $value);
         }
     }
     //why 'this'?
     //to emulate standard zend view functionality
     //doesn't mess up smarty in any way
     $this->_smarty->assign_by_ref('this', $this);
     //smarty needs a template_dir, and can only use templates,
     //found in that directory, so we have to strip it from the
     // filename
     //This checks the default application/smarty/template directory
     // as well as the module views/scripts directory to find the
     // template
     $paths = $this->getScriptPaths();
     $arg = func_get_arg(0);
     foreach ($paths as $path) {
         if (0 === strpos($arg, $path)) {
             if ($file = substr($arg, strlen($path))) {
                 $this->_smarty->template_dir = $path;
                 break;
             }
         }
     }
     //process the template (and filter the output)
     echo $this->_smarty->fetch($file);
 }
コード例 #10
0
ファイル: joinus.php プロジェクト: ECP-Black/ECP
function admin_joinus()
{
    global $db, $countries;
    $tpl = new smarty();
    $db->query('SELECT tname, `joinID`, `name`, b.username, b.email, b.icq, b.msn, `age`, b.country, `teamID`, `comment`, `IP`, `datum`, `closed`, `closedby`, a.username as closedby_username FROM ' . DB_PRE . 'ecp_joinus as b LEFT JOIN ' . DB_PRE . 'ecp_teams ON (teamID = tID) LEFT JOIN ' . DB_PRE . 'ecp_user as a ON (ID=closedby) ORDER BY closed ASC, datum ASC');
    $joinus = array();
    while ($row = $db->fetch_assoc()) {
        $row['datum'] = date(SHORT_DATE, $row['datum']);
        if ($row['joinID'] == (int) @$_GET['id']) {
            $spe = $row;
        }
        $joinus[] = $row;
    }
    if (@$spe) {
        ob_start();
        $tpl1 = new Smarty();
        foreach ($spe as $key => $value) {
            $tpl1->assign($key, $value);
        }
        $tpl1->assign('countryname', $countries[$spe['country']]);
        $tpl1->assign('id', $row['joinID']);
        $tpl1->display(DESIGN . '/tpl/admin/joinus_view.html');
        $tpl->assign('details', ob_get_contents());
        ob_end_clean();
    }
    $tpl->assign('joinus', $joinus);
    ob_start();
    $tpl->display(DESIGN . '/tpl/admin/joinus.html');
    $content = ob_get_contents();
    ob_end_clean();
    main_content(JOINUS, $content, '', 1);
}
コード例 #11
0
ファイル: table.php プロジェクト: HollenMok/pandoraf_v1.0
 public function display()
 {
     //Smarty engine/Smarty 引擎
     require ROOT . '/pf_core/smarty/libs/Smarty.class.php';
     $smarty = new Smarty();
     $table_fields = $this->initSqlFields();
     $smarty->assign('table_fields', $table_fields);
     $data_list = $this->loadData();
     foreach ($data_list as $k => $v) {
         if ($data_list[$k]['products_image']) {
             $data_list[$k]['products_image'] = '<img width="50" height="50" src="http://pandoraf.com/applications/pandoraf/templates/imgServer/thumb/list_grid/' . $v['products_image'] . '"/>';
         }
     }
     $smarty->assign('data_list', $data_list);
     if (0) {
         $contents = $smarty->fetch($this->data_tpl);
         $result = array();
         $result['page'] = 1;
         $result['total_page'] = 2;
         $result['contents'] = $contents;
         echo json_encode($result);
         return;
     }
     $smarty->display('web/table.html');
     exit;
 }
コード例 #12
0
ファイル: views.php プロジェクト: btalayminaei/DGSecurity
 function render($props, $message = NULL)
 {
     $smarty = new \Smarty();
     $smarty->assign($this->tpl, $props);
     $smarty->assign('message', $message);
     $smarty->display($this->tpl . '.tpl');
 }
コード例 #13
0
 public function render(array $data, $template)
 {
     foreach ($data as $name => $param) {
         $this->_engine->assign($name, $param);
     }
     return $this->_engine->fetch($template);
 }
コード例 #14
0
ファイル: Index.php プロジェクト: gueff/mymvc
 /**
  * adds the toolbar to the html dom before closing body tag
  * 
  * @access public
  * @static
  * @param \Smarty $oView
  * @return void
  */
 public static function injectToolbar(\Smarty $oView)
 {
     $sToolBarVarName = 'sToolBar_' . uniqid();
     $sInfoToolSmarty = '{$' . $sToolBarVarName . '}';
     // add toolbar template var to layout
     $aToolbar = \MVC\Registry::get('aToolbar');
     $oView->assign('aToolbar', $aToolbar);
     $oView->assign($sToolBarVarName, $oView->loadTemplateAsString(realpath(__DIR__ . '/../') . '/templates/infoTool.tpl'));
     // disable regular view output
     \MVC\View::$_bEchoOut = FALSE;
     // inject toolbar var to regular string output via DOM
     INJECT:
     $oDom = new \DOMDocument(null, null);
     // prevent error messages occuring by using DOM
     // @see http://stackoverflow.com/a/6090728/2487859
     libxml_use_internal_errors(true);
     // DOMDocument::loadHTML will treat your string as being in ISO-8859-1 unless you tell it otherwise.
     // @see http://stackoverflow.com/a/8218649/2487859
     $oDom->loadHTML(mb_convert_encoding($aToolbar['sRendered'], 'HTML-ENTITIES', 'UTF-8'));
     libxml_clear_errors();
     // add toolbar tag as a placeholder before body closing tag
     $oNode = $oDom->createElement($sToolBarVarName);
     $oBody = $oDom->getElementsByTagName('body');
     foreach ($oBody as $oItem) {
         $oItem->appendChild($oNode);
     }
     $sHtml = $oDom->saveHTML();
     // render the toolbar
     $sInfoToolRendered = $oView->fetch('string:' . $sInfoToolSmarty);
     // replace toolbar tag placeholder with rendered toolbar
     $sHtml = str_replace('<' . $sToolBarVarName . '></' . $sToolBarVarName . '>', $sInfoToolRendered, $sHtml);
     // new output, now including toolbar
     echo $sHtml;
 }
コード例 #15
0
 function handle()
 {
     if (isset($_GET['behav'])) {
         if ($_GET['behav'] == 'uploadimg') {
             $name = uniqid() . '.jpg';
             move_uploaded_file($_FILES["pic"]["tmp_name"], './jae/' . $name);
             upoadTmpFile('./jae/' . $name);
             $tmp = array();
             $tmp['url'] = getTmpFileUrl($name);
             $tmp['id'] = $name;
             echo json_encode($tmp);
             exit;
         }
     }
     $smarty = new Smarty();
     $smarty->assign('logined', isLogined());
     $smarty->display('libs/view/head.ctp');
     if (isset($_POST['bookname'])) {
         $name = explode('.', $_FILES["file"]["name"]);
         $name = $name[count($name) - 1];
         if ($name == 'mobi') {
             $id = $this->doUpload();
             header("location:index.php?action=detail&bid={$id}");
             //$smarty->assign('type','success');
             //$smarty->assign('message','上传成功');
         } else {
             $smarty->assign('type', 'error');
             $smarty->assign('message', '上传失败,文件类型错误');
         }
         //$smarty->display('libs/view/alert.ctp');
     }
     $smarty->display('libs/view/upload.ctp');
     $smarty->display('libs/view/tail.ctp');
 }
コード例 #16
0
ファイル: error_utils.php プロジェクト: howareyoucolin/demo
function ShowErrorPage($message)
{
    $smarty = new Smarty();
    $smarty->template_dir = '/components/templates';
    $smarty->assign('Message', $message);
    $smarty->assign('Captions', GetCaptions('UTF-8'));
    $smarty->display('error_page.tpl');
}
コード例 #17
0
 /**
  * The default function
  */
 public function init()
 {
     $this->smarty = new \Smarty();
     $this->smarty->setCompileDir(ROOT . '/' . $this->compilDir);
     $this->smarty->use_sub_dirs = false;
     $this->smarty->assign('index', $this->request->index);
     $this->smarty->assign('base', $this->request->base);
 }
コード例 #18
0
 /**
  * Assign variables to the template
  *
  * Allows setting a specific key to the specified value, OR passing
  * an array of key => value pairs to set en masse.
  *
  * @see __set()
  * @param string|array $spec The assignment strategy to use (key or
  * array of key => value pairs)
  * @param mixed $value (Optional) If assigning a named variable,
  * use this as the value.
  * @return void
  */
 public function assign($spec, $value = null)
 {
     if (is_array($spec)) {
         $this->_smarty->assign($spec);
         return;
     }
     $this->_smarty->assign($spec, $value);
 }
コード例 #19
0
 /**
  * @test
  * it should call display method on Smarty
  */
 public function it_should_call_display_method_on_smarty()
 {
     $sut = $this->make_instance();
     $this->smarty->assign('key1', 'value1')->shouldBeCalled();
     $this->smarty->assign('key2', 'value2')->shouldBeCalled();
     $this->smarty->fetch('some-template.tpl')->willReturn('foo');
     $sut->render('some-template', ['key1' => 'value1', 'key2' => 'value2']);
 }
コード例 #20
0
 /**
  * Assigns variables to specific placeholders on the target template
  *
  * @param  string $var_name Placeholder on the template
  * @param  string $value Value to be assigned to this placeholder
  * @return $this
  */
 public function assign($var_name, $value = '')
 {
     if (!is_array($var_name)) {
         $this->smarty->assign($var_name, $value);
     } else {
         $this->smarty->assign($var_name);
     }
     return $this;
 }
コード例 #21
0
ファイル: ViewAlbum.php プロジェクト: rx-projects/comicasa
 public function invokeHandler(Smarty $viewModel, Header $header, $f, $page, $aid)
 {
     $header->title('PayPic');
     $header->import('picbootstrap', 'mypage');
     $viewModel->assign("pname", "@RTPic");
     $album = new Album($aid);
     $viewModel->assign("images", $album->getImges());
     return "images";
 }
コード例 #22
0
 /**
  * Get smarty template
  * @return Smarty smarty object
  */
 public static function getSmartyTemplate()
 {
     /*
      if(extension_loaded('ionCube Loader')){
      include_once(SMARTY_DIR . "Smarty.class.php");
      }else{
      include_once(SMARTY_DIR . "Smarty.class.src.php");
      }
     *
     */
     $smarty = new \Smarty();
     $useTheme = !defined('OPENBIZ_USE_THEME') ? 0 : OPENBIZ_USE_THEME;
     if ($useTheme) {
         $theme = Openbiz::$app->getCurrentTheme();
         $themePath = $theme;
         // Openbiz::$app->getConfiguration()->GetThemePath($theme);
         if (is_dir(OPENBIZ_THEME_PATH . "/" . $themePath . "/template")) {
             $templateRoot = OPENBIZ_THEME_PATH . "/" . $themePath . "/template";
         } else {
             $templateRoot = OPENBIZ_THEME_PATH . "/" . $themePath . "/templates";
         }
         $smarty->template_dir = $templateRoot;
         $smarty->compile_dir = defined('OPENBIZ_SMARTY_CPL_PATH') ? OPENBIZ_SMARTY_CPL_PATH . "/" . $themePath : $templateRoot . "/cpl";
         $smarty->config_dir = $templateRoot . "/cfg";
         if (!file_exists($smarty->compile_dir)) {
             @mkdir($smarty->compile_dir, 0777);
         }
         // load the config file which has the images and css url defined
         $smarty->config_load('tpl.conf');
     } else {
         if (defined('SMARTY_TPL_PATH')) {
             $smarty->template_dir = SMARTY_TPL_PATH;
         }
         if (defined('OPENBIZ_SMARTY_CPL_PATH')) {
             $smarty->compile_dir = OPENBIZ_SMARTY_CPL_PATH . "/" . $themePath;
         }
         if (defined('SMARTY_CFG_PATH')) {
             $smarty->config_dir = SMARTY_CFG_PATH;
         }
     }
     if (!is_dir($smarty->compile_dir)) {
         mkdir($smarty->compile_dir, 0777);
     }
     // load the config file which has the images and css url defined
     $smarty->assign('app_url', OPENBIZ_APP_URL);
     $smarty->assign('app_index', OPENBIZ_APP_INDEX_URL);
     $smarty->assign('js_url', OPENBIZ_JS_URL);
     $smarty->assign('css_url', OPENBIZ_THEME_URL . "/" . $theme . "/css");
     $smarty->assign('resource_url', OPENBIZ_RESOURCE_URL);
     $smarty->assign('resource_php', OPENBIZ_RESOURCE_PHP);
     $smarty->assign('theme_js_url', OPENBIZ_THEME_URL . "/" . $theme . "/js");
     $smarty->assign('theme_url', OPENBIZ_THEME_URL . "/" . $theme);
     $smarty->assign('image_url', OPENBIZ_THEME_URL . "/" . $theme . "/images");
     $smarty->assign('lang', strtolower(I18n::getCurrentLangCode()));
     $smarty->assign('lang_name', I18n::getCurrentLangCode());
     return $smarty;
 }
コード例 #23
0
ファイル: function.checkbox.php プロジェクト: saiber/livecart
/**
 * ...
 *
 * @param array $params
 * @param Smarty $smarty
 * @return string
 *
 * @package application.helper.smarty.form
 * @author Integry Systems
 */
function smarty_function_checkbox($params, $smarty)
{
    if (empty($params['name'])) {
        $params['name'] = $smarty->getTemplateVars('input_name');
    }
    if (empty($params['id'])) {
        $params['id'] = uniqid();
    }
    $smarty->assign('last_fieldType', 'checkbox');
    $smarty->assign('last_fieldID', $params['id']);
    if (empty($params['class'])) {
        $params['class'] = 'checkbox';
    } else {
        $params['class'] .= ' checkbox';
    }
    $formParams = $smarty->_tag_stack[0][1];
    $formHandler = $formParams['handle'];
    if (!$formHandler instanceof Form) {
        throw new HelperException('Element must be placed in {form} block');
    }
    $fieldName = $params['name'];
    if (!isset($params['value'])) {
        $params['value'] = 1;
    }
    if (!empty($formParams['model'])) {
        $params['ng-model'] = $formParams['model'] . '.' . $params['name'];
    }
    // Check permissions
    if ($formParams['readonly']) {
        $params['disabled'] = 'disabled';
    }
    $formValue = $formHandler->get($fieldName);
    // get checkbox state if the form has been submitted
    if (1 == $formHandler->get('checkbox_' . $fieldName)) {
        if ($formValue == $params['value'] || 'on' == $params['value'] && 1 == $formValue) {
            $params['checked'] = 'checked';
        } else {
            unset($params['checked']);
        }
    } else {
        if ($params['value'] == $formValue) {
            $params['checked'] = 'checked';
        }
    }
    if (empty($params['checked'])) {
        unset($params['checked']);
    }
    $params['ng-true-value'] = 1;
    $params['ng-false-value'] = 0;
    $output = '<input type="checkbox"';
    foreach ($params as $name => $value) {
        $output .= ' ' . $name . '="' . $value . '"';
    }
    $output .= '/><input type="hidden" name="checkbox_' . $params['name'] . '" value="1" />';
    return $output;
}
コード例 #24
0
ファイル: view.php プロジェクト: rogerwilko/Yet-Another-Blog
 public function display($login, $alltags, $allyears, $coms)
 {
     $smarty = new Smarty();
     $smarty->assign("titrePage", "Liste des commentaires en attente de modération");
     $smarty->assign("coms", $coms);
     $smarty->assign('alltags', $alltags);
     $smarty->assign('allyears', $allyears);
     $smarty->assign('login', $login);
     $smarty->display("admincomment.tpl");
 }
コード例 #25
0
ファイル: donate.php プロジェクト: adrianshort/planningalerts
 function bind()
 {
     $smarty = new Smarty();
     $smarty->force_compile = true;
     $smarty->compile_dir = SMARTY_COMPILE_DIRECTORY;
     $smarty->assign("stats", stats::get_stats());
     $smarty->assign("page_title", "Donate to the Planning Alerts server fund");
     $smarty->assign("menu_item", "signup");
     $smarty->display('donate.tpl');
 }
コード例 #26
0
ファイル: error_utils.php プロジェクト: blakeHelm/BallotPath
function ShowErrorPage($message)
{
    $smarty = new Smarty();
    $smarty->template_dir = '/components/templates';
    $smarty->assign('Message', $message);
    $captions = GetCaptions('UTF-8');
    $smarty->assign('Captions', $captions);
    $smarty->assign('App', array('ContentEncoding' => 'UTF-8', 'PageCaption' => $captions->GetMessageString('Error')));
    $smarty->display('error_page.tpl');
}
コード例 #27
0
ファイル: view.php プロジェクト: rogerwilko/Yet-Another-Blog
 public function display($login, $alltags, $allyears, $articles)
 {
     $smarty = new Smarty();
     $smarty->assign("titrePage", "Liste des articles");
     $smarty->assign("articles", $articles);
     $smarty->assign('alltags', $alltags);
     $smarty->assign('allyears', $allyears);
     $smarty->assign('login', $login);
     $smarty->display("adminpost.tpl");
 }
コード例 #28
0
ファイル: SmartyView.php プロジェクト: nidzix/Newscoop
 /**
  * Render template
  */
 public function _run()
 {
     foreach ($this->getVars() as $key => $val) {
         $this->smarty->assign($key, $val);
     }
     $this->smarty->assign('view', $this);
     $this->smarty->assign('gimme', $this->smarty->context());
     $file = array_shift(func_get_args());
     $this->smarty->display($file);
 }
コード例 #29
0
ファイル: buyImage.php プロジェクト: rx-projects/comicasa
 public function invokeHandler(Smarty $viewModel, Header $header, $f, $page, $pid)
 {
     $header->title('PayPic');
     $header->import('jqgeeks/bootstrap_css', 'mypage');
     $viewModel->assign("pname", "@RTPic");
     global $RDb;
     $image = $RDb->fetch("select * from files where id=%d", $pid);
     $viewModel->assign("image", $image);
     return "image";
 }
コード例 #30
0
ファイル: ImageAccess.php プロジェクト: rx-projects/comicasa
 public function invokeHandler(Smarty $viewModel, Header $header, $f, $page)
 {
     $header->title('PayPic');
     $header->import('jqgeeks/bootstrap_css', 'mypage');
     $viewModel->assign("pname", "@RTPic");
     global $RDb;
     $imageAccess = $RDb->fetchAll("select * from file_access fa,files f,user u" . " where fa.pid=f.id and u.uid=fa.uid");
     $viewModel->assign("images", $imageAccess);
     return "imageAccess";
 }