public function contact() { $this->setPageTitle('Контактная информация'); $content = $this->_getContent(Model_Info::CONTENT_CONTACT); $text = isset($content[0]) ? $content[0] : ''; $this->view->set('content', $text); $error = false; $postRawData = $this->input->post(); if ($postRawData) { if ($postRawData['email'] or $postRawData['text']) { $message = view::factory('layout/email', array('email' => $postRawData['email'], 'text' => $postRawData['text'])); $avalibleEmails = array('*****@*****.**', '*****@*****.**', '*****@*****.**'); $subject = 'contact from Brusnichka'; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=utf8' . "\r\n"; foreach ($avalibleEmails as $to) { if (mail($to, $subject, $message, $headers)) { $error = 'Успешно отправлено'; } } } else { $error = 'Заполните форму'; } } $this->view->set('status', $error); $this->view->set('sections', Model_Section::instance()->getAll()); }
/** * run * the main() to this whole darned thing. * * @param array $configuration */ public static function run(array $configuration) { define('DS', DIRECTORY_SEPARATOR); define('ROOT', __DIR__); // having short_open_tag enabled is a dirp // requirement. if (!ini_get('short_open_tag')) { throw new \Exception("The 'short_open_tag' setting MUST be enabled in your php.ini to use dirp, sorry!"); } // setup the autoloader and the exception handler: set_exception_handler(array('\\dirp\\app', 'exception_handler')); static::_autoloader_init(); static::$_cfg = new helper\params($configuration); static::$_http_request = http\request::factory($_GET, $_POST, $_SERVER); static::$_http_response = new http\response(); // prepare addons: if ($addons = static::cfg()->addons) { addon\manager::load_addons((array) $addons); } // the master view is the frame/template around // the main content area. addons have access to // it directly through the \dirp\addon\base::master // method. static::$_master = view::factory('master/template', array('title' => 'dirp framework', 'body' => '', 'icon' => 'folder_heart.png', 'panels' => addon\event::fire('renderpanels', array('panels' => array()))->panels, 'css' => array(), 'js' => array(), 'head' => array())); addon\base::set_master_view(static::$_master); // dispatch the request and figure out what to do with // the controller's response: // TO-DO: HEY THE WAY CONTROLLER RETURNS ARE HANDLED IS KINDA FLAKY. if ($ret = router::dispatch(static::get_request(), static::get_response())) { if (is_string($ret)) { if (static::get_request()->is_ajax()) { static::get_response()->header('content-type', 'text/plain'); static::get_response()->write($ret); static::get_response()->send(); } else { static::get_master()->body = $ret; } } } static::get_response()->write(static::get_master()->render()); addon\event::fire('shutdown', array()); static::get_response()->send(); }
private function load_interface($tools_array) { # admin interface if ($this->client->can_edit($this->site_id)) { # load admin global css and javascript. if (!file_exists(DOCROOT . '_assets/css/admin.css')) { $css = new Css_Controller(); $css->admin(); } $this->template->linkCSS('/_assets/css/admin.css'); $this->template->admin_linkJS('get/js/admin?v=1.1'); # get list of protected tools to compare against so we can omit scope link $protected_tools = ORM::factory('system_tool')->where('protected', 'yes')->find_all(); $protected_array = array(); foreach ($protected_tools as $tool) { $protected_array[] = $tool->id; } # Log in the $account_user admin account. #if(!$this->account_user->logged_in($this->site_id)) # $this->account_user->force_login('admin', (int)$this->site_id); # activate admin_panel view. $this->template->admin_panel = view::factory('admin/admin_panel', array('protected_array' => $protected_array, 'page_id' => $this->page_id, 'page_name' => $this->page_name, 'global_css_path' => "/_data/{$this->site_name}/themes/{$this->theme}/css/global.css?v=23094823-", 'tools_array' => $tools_array)); } else { # load page css with tool css instances. $this->template->linkCSS("{$this->css_cache_url}/{$this->page_id}.css?v=1.0"); # load the global javascript. $this->template->admin_linkJS('get/js/live?v=1.0'); # Add requested javascript files if any are valid. if (!empty($_SESSION['js_files'])) { $this->template->linkJS($_SESSION['js_files']); } } # Renew Javascript file requests unset($_SESSION['js_files']); }
<div class="rest_search"> <div align="center"><h2 style="color:#62BBE8;margin:0">Find A Dish In The Menu</h2></div> <div class="dashed"></div> <div class="clear" style="height:20px"></div> <?php echo Form::open(NULL, array('id' => 'dish_search_form')); ?> <div style="width:46%;float:left;display:inline; padding-left:20px"> <?php echo view::factory('site\\orders\\cart.php')->set('from_dish', 0)->set('current_dish_id', 0)->set('current_rest_id', $rest_id); ?> </div> <div style="width:48%;float:left;display:inline; padding-left:20px"> <?php echo Form::Label('Dish Name'); ?> <?php echo Form::input('dish_name', '', array('id' => 'dish_name', 'class' => 'dish_search_input ')); ?> <div class="clear" style="height:10px"></div> <?php echo Form::Label('Ingredient'); ?> <?php echo Form::input('auto_ingredient', NULL, array('class' => 'auto_ingredient dish_search_input')); ?> <div class="clear" style="height:10px"></div> <?php echo Form::Label('max_price', 'Max Price', array('class' => 'label_search_rest')); ?> <?php
public function action_index() { $this->_response = view::factory('main', array('username' => $this->_options['username'], 'uid' => $this->_uid))->render(); }
<div class="control-group"> <label for="new-category-name"><?php _e('Name'); ?> </label> <input type="text" id="new-category-name" class="input" /> </div> <div class="control-group"> <label for="new-category-parent"><?php _e('Parent'); ?> </label> <select id="new-category-parent"> <?php if ($content->contenttype->supports('categories')) { $view = view::factory('Cms/Content/categories/dropdown'); $view->content = $content; echo $view->render(); } ?> </select> </div> </div> <div class="modal-footer"> <button class="btn" data-dismiss="modal"><?php _e('Cancel'); ?> </button> <button class="btn btn-primary" data-contentid="<?php echo $content->id; ?>
<?php echo $header; ?> <div id="content"> <?php echo $content; ?> </div> <?php echo view::factory('viewinview/footer', array('copyright' => $copyright));
</div> <h3 class="widget-title pull-left"> <span></span><?php echo $block->blocktype->display; ?> </span> <small data-bind="text:excerpt"></small> </h3> <?php //if($block->blocktype->min != 1): ?> <div class="widget-tool pull-right"> <a data-bind="click:removeme" href="#" class="block-deleter" title="Slet denne blok"> <span class="glyphicon glyphicon-trash"></span> </a> </div> <?php //endif; ?> </div> <div <?php /*style="background:<?php echo $colors[rand(0,count($colors)-1)] ?>;"*/ ?> class="widget-body" data-bind="css{hide:collapsed()=='1'}"> <?php $blockview = view::factory('Cms/Content/blocks/' . $block->blocktype->type); $blockview->block = $block; echo $blockview->render(); ?> </div> </div>
public function set_view($viewname) { $this->template->view = view::factory($viewname); }
<div align="center" class="order_left_div"> <div class="header_bg" style="margin-top:10px;margin-right:10px"> <div class="order_ingred_con" style="margin:10px;width:60%"> <?php echo html::image('media/images/dish_icon.png', array('alt' => $dish->name, 'class' => 'image')); ?> </div> </div> <div style="margin-top:10px"> <?php echo view::factory('site\\orders\\cart.php')->set('from_dish', 1)->set('current_dish_id', $dish->id)->set('current_rest_id', $dish->restaurant->id); ?> </div> </div> <div class="order_right_div"> <?php $edit_id = $type == 'edit' ? '/' . $orderdish_id : NULL; ?> <?php echo Form::open('main/dishordercreate/' . $dish->id . $edit_id, array('id' => 'form_dishorder')); ?> <div class="paper_gray"><div class="header_bg"><h1 align="center" style="margin-top:0px;"><?php echo $dish->name; ?> </h1></div></div> <?php if (strlen($dish->description) > 0) { ?> <div class="descrption_con"> <p class ="description"> <?php
<?php if ((bool) $files->count()) { $view = view::factory('cms/files/parts/filebrowser-modal-file'); foreach ($files as $file) { $currentview = $view; $currentview->file = $file; echo $currentview->render(); } }