Inheritance: extends Zend_Controller_Action
示例#1
0
 public function renderView()
 {
     if (!isset($_SESSION['cart'])) {
         $cart = new Cart();
         $_SESSION['cart'] = serialize($cart);
     }
     foreach ($this->model->getUris() as $key => $value) {
         if (preg_match("#^{$value}\$#", $this->uriView)) {
             if ($this->model->getView($key) === "PageView") {
                 $pagecontroller = new PageController($this->additionalParam);
                 $pagecontroller->renderView();
             } else {
                 if ($this->model->getView($key) === "ProductView") {
                     $productscontroller = new ProductsController();
                     $productscontroller->renderView();
                 } else {
                     if ($this->model->getView($key) === "SingleProductView") {
                         $singleproductcontroller = new SingleProductController($this->additionalParam);
                         $singleproductcontroller->renderView();
                     } else {
                         if ($this->model->getView($key) === "LoginView") {
                             $logincontroller = new LoginController($this->additionalParam);
                             $logincontroller->renderView();
                         } else {
                             if ($this->model->getView($key) === "CustomerView") {
                                 $customercontroller = new CustomerController();
                                 $customercontroller->renderView();
                             } else {
                                 if ($this->model->getView($key) === "CartView") {
                                     $cartcontroller = new CartController($this->additionalParam);
                                     $cartcontroller->renderView();
                                 } else {
                                     if ($this->model->getView($key) === "ContactView") {
                                         $contactcontroller = new ContactController($this->additionalParam);
                                         $contactcontroller->renderView();
                                     } else {
                                         if ($this->model->getView($key) === "RegisterView") {
                                             $registrationcontroller = new RegistrationController($this->additionalParam);
                                             $registrationcontroller->renderView();
                                         } else {
                                             if ($this->model->getView($key) === "CheckoutView") {
                                                 $checkoutcontroller = new CheckoutController($this->additionalParam);
                                                 $checkoutcontroller->renderView();
                                             } else {
                                                 $useView = $this->model->getView($key);
                                                 $view = new $useView();
                                                 $view->render();
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
 public static function ContactFormFunction()
 {
     $template = new SSViewer('ContactTemplateProvider');
     $controller = new ContactController();
     $form = $controller->ContactForm();
     // a little bit all over the show but to ensure a slightly easier upgrade for users
     // return back the same variables as previously done in comments
     return $template->process(new ArrayData(array('AddContactForm' => $form, 'SuccessMessage' => $controller->SuccessMessage())));
 }
示例#3
0
function create($request)
{
    if ($request['METHOD'] == 'POST' && !empty($request['name']) && !empty($request['email']) && filter_var($request['email'], FILTER_SANITIZE_EMAIL) && !empty($request['subject']) && !empty($request['body']) && !empty($request['g-recaptcha-response'])) {
        $name = $request['name'];
        $email = $request['email'];
        $subject = $request['subject'];
        $body = $request['body'];
        $g_recaptcha_response = $request['g-recaptcha-response'];
        $REMOTE_ADDR = $request['REMOTE_ADDR'];
        $c = new ContactController();
        $resp = $c->create(compact('name', 'email', 'subject', 'body', 'g_recaptcha_response', 'REMOTE_ADDR'));
        return true;
    }
    return View::NotFound();
}
示例#4
0
 public static function display()
 {
     $data = AFormatter::objectiveSettings(Applum::find(1));
     View::make('site/head/head');
     View::make("site/body/header/header");
     IntroController::intro($data);
     FeatureController::feature($data);
     AppController::app($data);
     SubscribeController::subscribe($data);
     GalleryController::gallery($data);
     TestimonialController::testimonial($data);
     PricingController::pricing($data);
     ContactController::contact($data);
     FooterController::footer($data);
 }
示例#5
0
<?php

include_once "controller/ContactController.php";
$controller = new ContactController();
$controller->invoke();
示例#6
0
            break;
        case 'hmacsha512':
            $twigVars['hmac'] = 'sha512';
            $twigTemplate = 'hmac';
            break;
        case 'hmacmd5':
            $twigVars['hmac'] = 'md5';
            $twigTemplate = 'hmac';
            break;
        case 'base64':
            require_once 'controller/base64Controller.php';
            $controller = new Base64Controller();
            break;
        case 'contact':
            require_once 'controller/contactController.php';
            $controller = new ContactController();
    }
    if (isset($controller)) {
        $vars = $controller->process();
        $render = $vars['render'];
        $twigVars = array_merge($twigVars, $vars);
    }
    if ($render === true) {
        echo $twig->render('page/' . $twigTemplate . '.twig', $twigVars);
    }
}
function determinePage()
{
    $pageId = "";
    if (isset($_GET['t'])) {
        $pageId = $_GET['t'];
示例#7
0
<?php

/**
 * @version		$Id: contact.php 14401 2010-01-26 14:10:00Z louis $
 * @package		Joomla
 * @subpackage	Contact
 * @copyright	Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
 * @license		GNU/GPL, see LICENSE.php
 * Joomla! is free software. This version may have been modified pursuant to the
 * GNU General Public License, and as distributed it includes or is derivative
 * of works licensed under the GNU General Public License or other free or open
 * source software licenses. See COPYRIGHT.php for copyright notices and
 * details.
 */
// no direct access
defined('_JEXEC') or die('Restricted access');
jimport('joomla.application.component.helper');
require_once JPATH_COMPONENT . DS . 'controller.php';
// Create the controller
$controller = new ContactController();
// Perform the Request task
$controller->execute(JRequest::getVar('task', null, 'default', 'cmd'));
// Redirect if set by the controller
$controller->redirect();
示例#8
0
<?php

/**
 * Created by PhpStorm.
 * User: 02483138
 * Date: 1.12.2015
 * Time: 19:39
 */
require_once "ContactController.php";
$contactCtrl = new ContactController();
$postdata = file_get_contents("php://input");
$model = json_decode($postdata);
$request = $_GET["request"];
var_dump($request);
if (isset($request)) {
    switch ($request) {
        case "save":
            $response = $contactCtrl->save($model);
            echo json_encode($response);
            break;
        case "email":
            $response = $contactCtrl->saveEmail($_POST);
            echo json_encode($response);
            break;
        default:
            echo "Your request is null!";
    }
}
示例#9
0
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 */
require_once "Libs/autoload.php";
$config = new Config();
$webPage = new PJSWebPage($config->getTitle() . ' - Delete Contact');
$act = Tools::Param('act');
if ("Delete Contact" === $act) {
    $contactModel = new ContactModel();
    $contactModel->populateFromForm();
    if (!$contactModel->validateForDelete()) {
        $contactView = new ContactFormView('Delete Contact', $contactModel);
        $body = "<h2>Invalid data</h2>\n" . $contactView->getForm();
    } else {
        $contactController = new ContactController();
        $contactController->delete($contactModel);
        $body = "Deleted contact # " . $contactModel->getId() . "<br />\n";
    }
} else {
    $contactController = new ContactController();
    $contactModel = $contactController->get(Tools::param('id'));
    $contactView = new ContactFormView('Delete Contact', $contactModel);
    $body = $contactView->getForm();
}
$webPage->setBody($body);
$webPage->displayPage();
示例#10
0
 /**
  * 
  * @param unknown $selectedContactId
  * @param unknown $readOnly
  * @return string Selection list of contacts
  * @throws ControllerException
  */
 public function getContactSelectList($selectedContactId, $readOnly)
 {
     $contactController = new ContactController('read');
     $contactModels = $contactController->getAll();
     $str = "<select name=\"contactId\" {$readOnly}>\n";
     if (!isset($selectedContactId) || 0 === $selectedContactId) {
         $str .= "  <option value=\"\" selected=\"selected\">None</option>\n";
     } else {
         $str .= "  <option value=\"\" >None</option>\n";
     }
     foreach ($contactModels as $contactModel) {
         $id = $contactModel->getId();
         $contactName = $contactModel->getContactName();
         $contactEmail = $contactModel->getContactEmail();
         $selected = $selectedContactId === $id ? 'selected="selected"' : '';
         $str .= "  <option value=\"{$id}\" {$selected}>{$contactName} ({$contactEmail})</option>\n";
     }
     $str .= "</select>\n";
     return $str;
 }
示例#11
0
$companyId = Tools::param('contactCompanyId');
$name = Tools::param('contactName');
$email = Tools::param('contactEmail');
$phone = Tools::param('contactPhone');
$alternatePhone = Tools::param('contactAlternatePhone');
$rowId = Tools::param('rowId');
$result = 'OK';
$contactId = '';
$newContactModel = null;
try {
    $contactModel = new ContactModel();
    $contactModel->setContactCompanyId($companyId);
    $contactModel->setContactName($name);
    $contactModel->setContactEmail($email);
    $contactModel->setContactPhone($phone);
    $contactModel->setContactAlternatePhone($alternatePhone);
    $contactController = new ContactController();
    $contactId = $contactController->add($contactModel);
    if (!($contactId > 0)) {
        throw new ControllerException("Add failed.");
    }
    $newContactModel = $contactController->get($contactId);
    $contactRowView = new ContactListView();
    $row = $contactRowView->displayContactRow($newContactModel, 'list');
} catch (ControllerException $e) {
    $contactRowView = new ContactListView('html', null);
    $contactModel->setId($rowId);
    $row = $contactRowView->displayContactRow($contactModel, 'add', 'Add Contact record failed. ' . $e->getMessage());
}
$result = array('result' => $result, 'row' => $row, 'newId' => $contactId);
echo json_encode($result) . PHP_EOL;
示例#12
0
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 */
require_once "Libs/autoload.php";
$config = new Config();
$webPage = new PJSWebPage($config->getTitle() . "Contacts - Add Contact");
$body = '';
$act = Tools::Param('act');
if ("Add Contact" === $act) {
    $model = new ContactModel();
    $model->populateFromForm();
    if (!$model->validateForAdd()) {
        $view = new ContactFormView('Add Contact', $model);
        $body = "<h2>Invalid data</h2>\n" . $view->getForm();
    } else {
        $contactController = new ContactController();
        $newId = $contactController->add($model);
        if ($newId > 0) {
            $body = "Added contact # " . $newId . "<br />\n";
        }
    }
} else {
    $body = "";
    $contactModel = new ContactModel();
    $companyId = '' === Tools::param('contactCompanyId') ? 0 : Tools::param('contactCompanyId');
    $contactModel->setContactCompanyId($companyId);
    $contactModel->setContactName(Tools::param('contactName'));
    $contactModel->setContactEmail(Tools::param('contactEmail'));
    $contactModel->setContactPhone(Tools::param('contactPhone'));
    $contactModel->setContactAlternatePhone(Tools::param('contactAlternatePhone'));
    $view = new ContactFormView("Add Contact", $contactModel);
 public function get_home_page()
 {
     return new DefaultHomePage($this->get_title(), ContactController::get_view());
 }
示例#14
0
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 */
require_once "Libs/autoload.php";
$auth = new Auth();
if (!$auth->isAuthorized()) {
    $auth->forbidden();
    exit(0);
    // Should never get here but just in case...
}
$result = "OK";
$id = Tools::param('id');
$mode = Tools::param('mode');
$html = '';
$contactListView = new ContactListView('html', null);
if ('add' == $mode) {
    $contactModel = new ContactModel();
    $contactModel->setId($id);
    $html = $contactListView->displayContactRow($contactModel, $mode);
} else {
    $contactController = new ContactController();
    $contactModel = $contactController->get($id);
    $html = $contactListView->displayContactRow($contactModel, $mode);
}
$result = array('result' => $result, 'row' => $html);
echo json_encode($result) . PHP_EOL;
示例#15
0
<?php

namespace App\Controllers;

$page = isset($_GET['page']) ? $_GET['page'] : 'home';
switch ($page) {
    case 'home':
        $controller = new HomeController();
        $controller->show();
        break;
    case 'personalmessage':
        $controller = new ContactController();
        $controller->show();
        break;
    case 'category':
        $controller = new RecipesController();
        $controller->showitems();
        break;
    case 'recipes':
        $controller = new RecipesController();
        $controller->show();
        break;
    case 'recipe.edit':
        $controller = new RecipesController();
        $controller->edit();
    case 'singlerecipe':
        $controller = new RecipesController();
        $controller->showIndividualRecipe();
        break;
    case 'register':
        $controller = new AuthenticationController();
示例#16
0
    /**
     * Return the HTML view
     *
     * @return string
     */
    private function _getHtmlView()
    {
        $body = <<<'HTML'
<a href="addJob.php">Add a new job</a><br />
<table border="1" cellspacing="0" cellpadding="2">
  <caption>Current Jobs</caption>
  <tr>
    <th>Actions</th>
    <th>Urgency</th>
    <th>Title</th>
    <th>Location</th>
    <th>Company</th>
    <th>Contact</th>
    <th>Status</th>
    <th>Next Action</th>
    <th>Next Action Due</th>
    <th>Link</th>
    <th>Created</th>
    <th>Updated</th>
  </tr>
HTML;
        foreach ($this->getJobModels() as $jobModel) {
            $id = $jobModel->getId();
            $primaryContactId = $jobModel->getPrimaryContactId();
            $companyId = $jobModel->getCompanyId();
            $applicationStatusId = $jobModel->getApplicationStatusId();
            $lastStatusChange = $jobModel->getLastStatusChange();
            $urgency = $jobModel->getUrgency();
            $created = $jobModel->getCreated();
            $updated = $jobModel->getUpdated();
            $nextActionDue = $jobModel->getNextActionDue();
            $nextAction = $jobModel->getNextAction();
            $positionTitle = $jobModel->getPositionTitle();
            $location = $jobModel->getLocation();
            $url = $jobModel->getUrl();
            if ($primaryContactId >= 1) {
                $contactController = new ContactController('read');
                $contactModel = $contactController->get($primaryContactId);
                $contactName = $contactModel->getContactName();
            }
            if ($companyId >= 1) {
                $companyController = new CompanyController('read');
                $companyModel = $companyController->get($companyId);
                $companyName = $companyModel->getCompanyName();
            } else {
                $companyName = '';
            }
            if ($applicationStatusId >= 1) {
                $applicationStatusController = new ApplicationStatusController('read');
                $applicationStatusModel = $applicationStatusController->get($applicationStatusId);
                $applicationStatusValue = $applicationStatusModel->getStatusValue();
                $applicationStatusStyle = $applicationStatusModel->getStyle();
            } else {
                $applicationStatusValue = '';
                $applicationStatusStyle = '';
            }
            $body .= <<<HTML
  <tr>
    <td>
        <a href="editJob.php?id={$id}">Edit</a>
      | <a href="deleteJob.php?id={$id}">Delete</a>
    </td>
    <td>{$urgency}</td>
    <td>{$positionTitle}</td>
    <td>{$location}</td>
    <td>{$companyName}</td>
    <td>{$contactName}</td>
    <td style="{$applicationStatusStyle}">{$applicationStatusValue}</td>
    <td>{$nextAction}</td>
    <td>{$nextActionDue}</td>
    <td><a href="{$url}">{$url}</a></td>
    <td>{$created}</td>
    <td>{$updated}</td>
  </tr>
HTML;
        }
        $body .= '</table>';
        return $body;
    }