コード例 #1
0
ファイル: HtmlDimmer.php プロジェクト: jcheron/phalcon-jquery
 public function run(JsUtils $js)
 {
     if ($this->_container instanceof HtmlSingleElement) {
         $this->_bsComponent = $js->semantic()->dimmer("#" . $this->_container->getIdentifier(), $this->_params);
     }
     return parent::run($js);
 }
コード例 #2
0
 public function compile(JsUtils $js = null)
 {
     if ($js == null) {
         return;
     }
     $result = "";
     $params = "{}";
     $callback = NULL;
     $attr = "id";
     $validation = false;
     $stopPropagation = true;
     $preventDefault = true;
     extract($this->parameters);
     if ($preventDefault === true) {
         $result .= "\nevent.preventDefault();\n";
     }
     if ($stopPropagation === true) {
         $result .= "event.stopPropagation();\n";
     }
     switch ($this->method) {
         case "get":
             $result .= $js->getDeferred($url, $responseElement, $params, $callback, $attr);
             break;
         case "post":
             $result .= $js->postDeferred($url, $responseElement, $params, $callback, $attr);
             break;
         case "postForm":
             $result .= $js->postFormDeferred($url, $form, $responseElement, $validation, $callback, $attr);
             break;
     }
     return $result;
 }
コード例 #3
0
 public function run(JsUtils $js)
 {
     if (isset($this->_bsComponent) === false) {
         $this->_bsComponent = $js->semantic()->accordion("#" . $this->identifier, $this->params);
     }
     $this->addEventsOnRun($js);
     return $this->_bsComponent;
 }
コード例 #4
0
ファイル: HtmlSearch.php プロジェクト: jcheron/phalcon-jquery
 public function run(JsUtils $js)
 {
     $this->_params["onSelect"] = '%function(result,response){$(%quote%#' . $this->identifier . '%quote%).trigger(%quote%onSelect%quote%, {%quote%result%quote%: result, %quote%response%quote%:response} );}%';
     $searchFields = \json_encode($this->_searchFields);
     $searchFields = str_ireplace("\"", "%quote%", $searchFields);
     $this->_params["searchFields"] = "%" . $searchFields . "%";
     if ($this->_local === true) {
         $this->_params["source"] = "%content%";
         $this->addEvent("beforeExecute", "var content=" . $this->resultsToJson() . ";");
     }
     if (isset($this->_bsComponent) === false) {
         $this->_bsComponent = $js->semantic()->search("#" . $this->identifier, $this->_params);
     }
     $this->addEventsOnRun($js);
     return $this->_bsComponent;
 }
コード例 #5
0
ファイル: HtmlForm.php プロジェクト: jcheron/phalcon-jquery
 public function compile(JsUtils $js = NULL, &$view = NULL)
 {
     if (isset($js)) {
         $this->formElementsPrefix = $js->config()->getVar("formElementsPrefix");
         foreach ($this->futureElements as $futureElement) {
             $futureElementValue = $this->getPrefix($futureElement);
             $futureElementValues = explode("_", $futureElementValue);
             switch ($futureElementValues[0]) {
                 case "input":
                     $control = new HtmlInput($futureElement);
                     $control->setClass("form-control");
                     $control->setLabel($this->getPart($futureElement));
                     break;
                 case "checkbox":
                     $control = new HtmlInputCheckbox($futureElement);
                     $control->setLabel($this->getPart($futureElement), false);
                     break;
                 case "radio":
                     $name = $this->getPart($futureElement);
                     $label = $this->getPart($futureElement, 2);
                     $control = new HtmlInputRadio($futureElement);
                     $control->setProperty("name", strtolower($name));
                     $control->setLabel($label, false);
                     break;
                 case "select":
                     $control = new HtmlSelect($futureElement);
                     $control->setProperty("size", $futureElementValues[1]);
                     $control->setClass("form-control");
                     $control->setLabel($this->getPart($futureElement));
                     break;
                 default:
                     $control = new HtmlInput($futureElement);
                     $control->setClass("form-control");
                     $control->setLabel($this->getPart($futureElement));
                     break;
             }
             $this->addElement($control);
         }
     }
     foreach ($this->formGroups as $group) {
         $this->addContent($group);
     }
     return parent::compile($js, $view);
 }
コード例 #6
0
ファイル: HtmlPopup.php プロジェクト: jcheron/phalcon-jquery
 /**
  * {@inheritDoc}
  * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::run()
  */
 public function run(JsUtils $js)
 {
     $this->_params["popup"] = "#" . $this->identifier;
     $js->semantic()->popup("#" . $this->_container->getIdentifier(), $this->_params);
 }
コード例 #7
0
 public function run(JsUtils $js)
 {
     $this->_bsComponent = $js->bootstrap()->generic("#" . $this->identifier);
     if (array_key_exists("data-toggle", $this->properties)) {
         $this->_bsComponent->addCode("\$.fn.toggled=function(){return this.hasClass('active');};");
     }
     $this->addEventsOnRun($js);
     return $this->_bsComponent;
 }
コード例 #8
0
 /**
  * Js component creation when dropdownItem is in Navs/Pills
  * @param JsUtils $js
  */
 public function runNav(JsUtils $js)
 {
     $js->bootstrap()->tab("#" . $this->identifier);
 }
コード例 #9
0
 /**
  * render the content of $controller::$action and set the response to a new panel
  * @param JsUtils $js
  * @param string $title The panel title
  * @param Controller $initialControllerInstance
  * @param string $controllerName the controller name
  * @param string $actionName the action name
  */
 public function forwardPanel(JsUtils $js, $title, $initialControllerInstance, $controllerName, $actionName, $params = NULL)
 {
     return $this->addPanel($title, $js->forward($initialControllerInstance, $controllerName, $actionName, $params));
 }
コード例 #10
0
ファイル: HtmlLink.php プロジェクト: jcheron/phalcon-jquery
 public function run(JsUtils $js)
 {
     $this->_bsComponent = $js->semantic()->generic("#" . $this->identifier);
     $this->addEventsOnRun($js);
     return $this->_bsComponent;
 }
コード例 #11
0
 public function jsGetContent(JsUtils $js, $url)
 {
     return $js->getDeferred($url, "#" . $this->identifier . " .modal-body");
 }
コード例 #12
0
 /**
  * Generate the jquery script to set the elements to the HtmlNavElement
  * @param JsUtils $jsUtils
  */
 public function jsSetContent(JsUtils $jsUtils)
 {
     $jsUtils->html("#" . $this->identifier, str_replace("\"", "'", $this->contentAsString()), true);
 }
コード例 #13
0
 public function run(JsUtils $js)
 {
     $this->_bsComponent = $js->semantic()->generic("#" . $this->identifier);
     parent::run($js);
     $this->addEventsOnRun($js);
     if (isset($this->_popup)) {
         $this->_popup->run($js);
     }
     return $this->_bsComponent;
 }
コード例 #14
0
ファイル: HtmlPanel.php プロジェクト: jcheron/phalcon-jquery
 public function run(JsUtils $js)
 {
     if ($this->_collapsable) {
         $this->_bsComponent = $js->bootstrap()->collapse("#lnk-" . $this->identifier);
         $this->_bsComponent->setCollapsed("#collapse-" . $this->identifier);
         if ($this->_showOnStartup === true) {
             $this->_bsComponent->show();
         }
     }
     return $this->_bsComponent;
 }
コード例 #15
0
 /**
  * Add new elements in breadcrumbs corresponding to request dispatcher : controllerName, actionName, parameters
  * @param JsUtils $js
  * @param Dispatcher $dispatcher the request dispatcher
  * @return \Ajax\bootstrap\html\HtmlBreadcrumbs
  */
 public function fromDispatcher(JsUtils $js, $dispatcher, $startIndex = 0)
 {
     return $this->addItems($js->fromDispatcher($dispatcher));
 }
コード例 #16
0
 public function run(JsUtils $js)
 {
     if ($this->propertyContains("class", "simple") === false) {
         if (isset($this->_bsComponent) === false) {
             $this->_bsComponent = $js->semantic()->dropdown("#" . $this->identifier, $this->_params);
         }
         $this->addEventsOnRun($js);
         return $this->_bsComponent;
     }
 }
コード例 #17
0
 /**
  * render the content of $controller::$action and set the response to a new panel
  * @param JsUtils $js
  * @param string $title The panel title
  * @param Controller $initialController
  * @param string $controller a Phalcon controller
  * @param string $action a Phalcon action
  * @param array $params
  */
 public function forwardPanel(JsUtils $js, $title, $initialController, $controller, $action, $params = array())
 {
     return $this->addPanel($title, $js->forward($initialController, $controller, $action, $params));
 }
コード例 #18
0
 public function setJs(JsUtils $js)
 {
     $this->js = $js;
     $this->_di = $js->getDi();
 }
コード例 #19
0
 /**
  * Add new elements in breadcrumbs corresponding to request dispatcher : controllerName, actionName, parameters
  * @param JsUtils $js
  * @param Dispatcher $dispatcher the request dispatcher
  * @return \Ajax\bootstrap\html\HtmlBreadcrumbs
  */
 public function fromDispatcher(JsUtils $js, $dispatcher, $startIndex = 0)
 {
     $this->startIndex = $startIndex;
     return $this->addElements($js->fromDispatcher($dispatcher));
 }
コード例 #20
0
        $volt->setOptions(array('compiledPath' => $config->application->cacheDir, 'compiledSeparator' => '_'));
        return $volt;
    }, '.phtml' => 'Phalcon\\Mvc\\View\\Engine\\Php'));
    return $view;
}, true);
/**
 * Database connection is created based in the parameters defined in the configuration file
 */
$di->set('db', function () use($config) {
    return new DbAdapter(array('host' => $config->database->host, 'username' => $config->database->username, 'password' => $config->database->password, 'dbname' => $config->database->dbname, 'options' => array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8')));
});
/**
 * If the configuration specify the use of metadata adapter use it or use memory otherwise
 */
$di->set('modelsMetadata', function () {
    return new MetaDataAdapter();
});
/**
 * Start the session the first time some component request the session service
 */
$di->set('session', function () {
    $session = new SessionAdapter();
    $session->start();
    return $session;
});
$di->set("jquery", function () {
    $jquery = new JsUtils(array("driver" => "Jquery"));
    $jquery->bootstrap(new Bootstrap());
    //for Twitter Bootstrap
    return $jquery;
});
コード例 #21
0
 public function run(JsUtils $js)
 {
     $this->_bsComponent = $js->bootstrap()->collapse("#" . $this->element->getIdentifier());
     $this->addEventsOnRun($js);
     return $this->_bsComponent;
 }
コード例 #22
0
 public function run(JsUtils $js)
 {
     $this->_bsComponent = $js->bootstrap()->carousel("#" . $this->identifier);
     $this->addEventsOnRun($js);
     return $this->_bsComponent;
 }
コード例 #23
0
 public static function submitButton(JsUtils $js, $url, $form, $responseElement, $caption = "Okay")
 {
     return new DialogButton($caption, $js->postForm($url, $form, $responseElement) . ";\$( this ).dialog( 'close' );");
 }
コード例 #24
0
 public function run(JsUtils $js)
 {
     $js->semantic()->popup("#" . $this->semElement->getIdentifier(), $this->params);
 }
コード例 #25
0
 /**
  * set the active page corresponding to request dispatcher : controllerName, actionName, parameters and $urlMask
  * @param JsUtils $js
  * @param Dispatcher $dispatcher the request dispatcher
  * @return \Ajax\bootstrap\html\HtmlPagination
  */
 public function fromDispatcher(JsUtils $js, $dispatcher, $startIndex = 0)
 {
     $items = $js->fromDispatcher($dispatcher);
     $url = implode("/", $items);
     if ($this->urlMask === "%page%") {
         $this->urlMask = preg_replace("/[0-9]/", "%page%", $url);
     }
     for ($index = $this->from; $index <= $this->to; $index++) {
         if ($this->getUrl($index) == $url) {
             $this->setActive($index);
             break;
         }
     }
     return $this;
 }