Beispiel #1
0
 protected function generateMetaDescription()
 {
     sfProjectConfiguration::getActive()->loadHelpers('StringFunc');
     $result = '';
     switch ($this->getCurrentPageType()) {
         case self::ARTICLE_PAGE:
             //pealkiri. Sisu (250 chars)
             if ($this->getRoute()->getObject()->getMetadescription()) {
                 return $this->getRoute()->getObject()->getMetadescription();
             }
             $content = truncate(strip_tags($this->getRoute()->getObject()->getTitle() . '. ' . $this->getRoute()->getObject()->getContent()), 250, '');
             break;
         case self::CATEGORY_PAGE:
             // category name, products
             if ($this->getRoute()->getCategoryObject()->getMetaDescription()) {
                 return $this->getRoute()->getCategoryObject()->getMetaDescription();
             }
             $content = implode(',', $this->getProductCategoryPageWords($this->getRoute()->getCategoryObject()));
             break;
         case self::PRODUCT_PAGE:
             //toote nimi (kategooriad) - toode kirjelduse esimesed tähemärgid
             $content = $this->getRoute()->getProductObject()->getName() . ' (' . implode(', ', $this->getProductCategoryPageWords($this->getRoute()->getCategoryObject())) . ') ' . $this->getRoute()->getProductObject()->getDescription();
             break;
     }
     $result = truncate(strip_tags($content), 250, '');
     return $result;
 }
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeIndex(sfWebRequest $request)
 {
     $this->class = $request->getParameter('class');
     if (empty($this->class)) {
         $this->class = $request->getGetParameter('class');
     }
     $this->method = $request->getParameter('method');
     if (empty($this->method)) {
         $this->method = $request->getGetParameter('method');
     }
     if (!empty($this->method)) {
         $this->class = array($this->class, $this->method);
     }
     $this->viewer = new sfCodeViewer($this->class);
     if ($request->isXmlHttpRequest()) {
         sfProjectConfiguration::getActive()->loadHelpers('Url');
         $this->renderText($this->viewer->render(url_for('sfCodeView')));
         return sfView::NONE;
     } else {
         // maintain history
         $this->history = $this->getUser()->getAttribute('history', array());
         if (false !== ($index = array_search($this->class, $this->history))) {
             unset($this->history[$index]);
         }
         array_unshift($this->history, $this->class);
         array_splice($this->history, 10);
         $this->getUser()->setAttribute('history', $this->history);
     }
 }
Beispiel #3
0
 public static function getDefaultCulture()
 {
     if (!self::$initialized && class_exists('sfProjectConfiguration', false)) {
         self::initialize(sfProjectConfiguration::getActive()->getEventDispatcher());
     }
     return self::$defaultCulture;
 }
Beispiel #4
0
 public function executeNovaPagina(sfWebRequest $request)
 {
     if ($request->isXmlHttpRequest() || true) {
         //apenas por ajax
         sfConfig::set('sf_web_debug', false);
         sfProjectConfiguration::getActive()->loadHelpers(array('I18N', 'Date'));
         $cmspage = new Cmspage();
         $content = new Content();
         $content->setId(null);
         $cmspage->setContent($content);
         $cmspage->setId(null);
         $cmsGroupcontent = $this->getUser()->getAttribute('contentGroup');
         $this->forward404Unless($cmsGroupcontent);
         $cmspage->setCmsgroupcontent($cmsGroupcontent);
         $this->formContent = new PageContentForm($cmspage);
         if ($request->isMethod('post')) {
             //return $this->renderPartial('cms/debug',array('values'=>$request->getParameter('pagina')));
             $this->formContent->bind($request->getParameter('pagina'));
             if ($this->formContent->isValid()) {
                 $this->logMessage('O formContent foi válido. cms/actions: ' . __FILE__ . __LINE__);
                 try {
                     $this->formContent->save();
                     return $this->renderPartial("cms/viewPage", array('page' => $this->formContent->getCmspageobj(), 'isNew' => true, 'values' => $this->formContent->getValues()));
                 } catch (Exception $e) {
                     //TODO: We should to handle the error and render it.
                     throw $e;
                 }
                 //return $this->renderPartial("cms/viewPage",array('page'));
             }
         }
         //parent::executeNew($request);
         return $this->renderPartial('cms/content_form', array('formContent' => $this->formContent));
     }
 }
 public function setup()
 {
     parent::setup();
     sfProjectConfiguration::getActive()->loadHelpers(array('I18N'));
     $this->required = __('Required', array(), 'vjComment');
     $this->invalid_mail = __('Invalid Mail', array(), 'vjComment');
     $this->invalid_url = __('Invalid Url', array(), 'vjComment');
     $this->required_msg = __('Required message', array(), 'vjComment');
     $this->widgetSchema['record_model'] = new sfWidgetFormInputHidden();
     $this->widgetSchema['record_id'] = new sfWidgetFormInputHidden();
     $this->widgetSchema['reply'] = new sfWidgetFormInputHidden();
     $this->widgetSchema['reply_author'] = new sfWidgetFormInputHidden();
     $this->widgetSchema['user_name'] = new sfWidgetFormInputHidden();
     $this->validatorSchema['reply'] = new sfValidatorPass();
     $this->validatorSchema['reply_author'] = new sfValidatorPass();
     $this->validatorSchema['user_name'] = new sfValidatorPass();
     $this->widgetSchema->setLabel('author_name', __('Name', array(), 'vjComment'));
     $this->widgetSchema->setLabel('author_email', 'Email');
     $this->widgetSchema->setLabel('author_website', __('Website', array(), 'vjComment'));
     $this->widgetSchema->setLabel('body', 'Message');
     $this->widgetSchema->setHelp('author_website', __('Must start with http:// or https://', array(), 'vjComment'));
     $this->validatorSchema['author_email'] = new sfValidatorEmail();
     $this->validatorSchema['author_website'] = new sfValidatorUrl();
     $this->validatorSchema['author_name']->setMessage('required', $this->required);
     $this->validatorSchema['author_email']->setMessage('required', $this->required)->setMessage('invalid', $this->invalid_mail);
     $this->validatorSchema['author_website']->setOption('required', false)->setMessage('invalid', $this->invalid_url);
     $this->validatorSchema['body']->setOption('required', true)->setMessage('required', $this->required_msg);
 }
 public function reloadClasses($force = false)
 {
     // only (re)load the autoloading cache once per request
     if (self::$freshCache) {
         return;
     }
     $configuration = sfProjectConfiguration::getActive();
     if (!$configuration || !$configuration instanceof sfApplicationConfiguration) {
         return;
     }
     self::$freshCache = true;
     if (file_exists($configuration->getConfigCache()->getCacheName('config/autoload.yml'))) {
         self::$freshCache = false;
         if ($force) {
             unlink($configuration->getConfigCache()->getCacheName('config/autoload.yml'));
         }
     }
     $file = $configuration->getConfigCache()->checkConfig('config/autoload.yml');
     $this->classes = (include $file);
     //If the user has specified provided one or more class paths
     foreach ($this->overriden as $class => $path) {
         $this->classes[$class] = $path;
     }
     //Remove non Peer classes from the array.
     foreach ($this->classes as $className => $path) {
         if (substr($className, -4, 4) != 'Peer' || substr($className, -4, 4) == 'Peer' && substr($className, 0, 4) == 'Base') {
             unset($this->classes[$className]);
         }
     }
 }
    protected function execute($arguments = array(), $options = array()) {
        $databaseManager = new sfDatabaseManager($this->configuration);
        $connection = $databaseManager->getDatabase($options['connection'] ? $options['connection'] : null)->getConnection();
        $context = sfContext::createInstance($this->configuration);
        sfProjectConfiguration::getActive()->loadHelpers('Partial', 'I18N', 'Url');
        $serverUrl = $options['setenvironment'] == '' ? $serverUrl = $options['host'] : $serverUrl = $options['host'] . '/' . $options['setenvironment'];
        $workflows = WorkflowVersionTable::instance()->getWorkflowsToStart(time())->toArray();
        foreach($workflows as $workflow) {
            $sender = WorkflowTemplateTable::instance()->getWorkflowTemplateById($workflow['workflowtemplate_id'])->toArray();
            $userSettings = new UserMailSettings($sender[0]['sender_id']);
            $sendMail = new SendStartWorkflowEmail($userSettings, $context, $workflow, $sender, $serverUrl);
            $workflowTemplate = WorkflowTemplateTable::instance()->getWorkflowTemplateByVersionId($workflow['id']);
            WorkflowVersionTable::instance()->startWorkflowInFuture($workflow['id']);
            $sendToAllSlotsAtOnce = $workflowTemplate[0]->getMailinglistVersion()->toArray();
            if($sendToAllSlotsAtOnce[0]['sendtoallslotsatonce'] == 1) {
                $calc = new CreateWorkflow($workflow['id']);
                $calc->setServerUrl($serverUrl);
                $calc->setContext($context);
                $calc->addAllSlots();
            }
            else {
                $calc = new CreateWorkflow($workflow['id']);
                $calc->setServerUrl($serverUrl);
                $calc->setContext($context);
                $calc->addSingleSlot();
            }

        }
  }
 public function reloadClasses($force = false)
 {
       if (self::$freshCache && !$force)
   {
     return false;
   }
   $configuration = sfProjectConfiguration::getActive();
   if (!$configuration || !$configuration instanceof sfApplicationConfiguration)
   {
     return false;
   }
   self::$freshCache = true;
   if (file_exists($configuration->getConfigCache()->getCacheName('config/autoload.yml')))
   {
     self::$freshCache = false;
     if ($force)
     {
       unlink($configuration->getConfigCache()->getCacheName('config/autoload.yml'));
     }
   }
   $file = $configuration->getConfigCache()->checkConfig('config/autoload.yml');
   $this->classes = include($file);
   foreach ($this->overriden as $class => $path)
   {
     $this->classes[$class] = $path;
   }
   return true;
 }
 public static function get()
 {
     sfProjectConfiguration::getActive()->loadHelpers(array("Url"));
     sfProjectConfiguration::getActive()->loadHelpers(array("Tag"));
     //TODO: fix this
     return "<div id='skulebar'>\n\t\t<a id='skule' href='/'>Skule Courses</a>\n\t\t<form method='get' action='" . url_for("search/fuzzySearch") . "' name='frmSearchBar'>\n\t\t<div style='margin: 0pt; padding: 0pt; display: inline;'>\n\t\t</div>\n\t\t<input type='text' title='Quick search in Skule Courses' size='30' name='query' id='search_search' autocomplete='off'/>\n\t\t</form>\n\t\t<div id='user'>\n\t\t<a href='/login'>Login</a>\n\t\t</div>\n\t\t</div>";
 }
 public function __construct($containerObject, $attributes = array())
 {
     $this->afExtjs = afExtjs::getInstance();
     if (isset($attributes['label'])) {
         $this->attributes['text'] = $attributes['label'];
         unset($attributes['label']);
     }
     if (isset($attributes['url'])) {
         $param_name = isset($attributes['param']) ? $attributes['param'] : "param";
         $url = $attributes['url'] . "&" . $param_name . "=";
         $param = $containerObject->privateName . '.stack["text"]';
         $cellDiv = $containerObject->privateName . '.stack["cellDiv"]';
         if (isset($attributes['ajax'])) {
             sfProjectConfiguration::getActive()->loadHelpers(array('afExtjsContextMenu'));
             $source = ajax_source($url . '"+' . $param);
         } else {
             $source = 'window.location.href="' . $url . '"+' . $param;
         }
         $this->attributes['handler'] = $this->afExtjs->asMethod(array('parameters' => '', 'source' => $source));
         unset($attributes['url']);
         unset($attributes['ajax']);
         unset($attributes['param']);
     }
     if (isset($attributes['source'])) {
         $this->attributes['handler'] = $this->afExtjs->asMethod(array('parameters' => '', 'source' => $attributes["source"]));
     }
     parent::__construct($containerObject, $attributes);
 }
Beispiel #11
0
 public function configure()
 {
     sfProjectConfiguration::getActive()->loadHelpers(array('Asset', 'Thumb'));
     $this->widgetSchema['asso_id'] = new sfWidgetFormInputHidden();
     $this->widgetSchema['start_date'] = new sfWidgetDatePicker();
     $this->validatorSchema['start_date'] = new sfValidatorDatePicker(array());
     $this->widgetSchema['end_date'] = new sfWidgetDatePicker();
     $this->validatorSchema['end_date'] = new sfValidatorDatePicker(array());
     $this->widgetSchema['affiche'] = new sfWidgetFormInputFileEditable(array('file_src' => doThumb($this->getObject()->getAffiche(), 'events', array('width' => 150, 'height' => 150), 'scale'), 'is_image' => true, 'edit_mode' => !$this->isNew() && $this->getObject()->getAffiche(), 'with_delete' => true, 'delete_label' => "Supprimer cette illustration"));
     $this->validatorSchema['affiche'] = new sfValidatorFileImage(array('required' => false, 'path' => sfConfig::get('sf_upload_dir') . '/events/source', 'mime_types' => 'web_images', 'max_width' => 1000, 'max_height' => 1000));
     $this->widgetSchema['guest_asso_list']->setOption('method', 'getName');
     $this->widgetSchema->setLabel('guest_asso_list', 'Associations Partenaires');
     $this->widgetSchema['guest_asso_list']->setAttributes(array('style' => 'width:100%;', 'class' => 'select2'));
     $this->validatorSchema['affiche_delete'] = new sfValidatorBoolean();
     $this->widgetSchema->setLabel('name', 'Nom');
     $this->widgetSchema->setLabel('type_id', 'Type');
     $this->widgetSchema->setLabel('start_date', 'Début');
     $this->widgetSchema->setLabel('end_date', 'Fin');
     $this->widgetSchema->setLabel('summary', 'Résumé en une ligne');
     $this->widgetSchema->setLabel('description', 'Description');
     $this->widgetSchema->setLabel('place', 'Lieu');
     $this->widgetSchema->setLabel('is_public', 'Ouvert au public ?');
     $this->widgetSchema->setLabel('affiche', 'Illustration');
     $this->widgetSchema->setLabel('is_weekmail', 'Paraître dans le Weekmail ?');
     $this->widgetSchema['is_weekmail']->setAttribute('style', 'width: 15px;');
     $this->useFields(array('asso_id', 'name', 'type_id', 'start_date', 'end_date', 'summary', 'description', 'place', 'is_public', 'affiche', 'is_weekmail', 'guest_asso_list'));
 }
Beispiel #12
0
 public function __toString()
 {
     $linkable = $this->getPropertyValue('linkable', true);
     if ($linkable instanceof sfOutputEscaperArrayDecorator || is_array($linkable)) {
         list($method, $params) = $linkable;
         $linkable = call_user_func_array(array($this->dataObject, $method), $params->getRawValue());
     }
     if ($linkable) {
         $placeholderGetters = $this->getPropertyValue('placeholderGetters');
         $urlPattern = $this->getPropertyValue('urlPattern');
         $url = $urlPattern;
         foreach ($placeholderGetters as $placeholder => $getter) {
             $placeholderValue = is_array($this->dataObject) ? $this->dataObject[$getter] : $this->dataObject->{$getter}();
             $url = preg_replace("/\\{{$placeholder}\\}/", $placeholderValue, $url);
         }
         if (preg_match('/^index.php/', $url)) {
             sfProjectConfiguration::getActive()->loadHelpers('Url');
             $url = public_path($url, true);
         }
         $linkAttributes = array('href' => $url);
         if ($this->hasProperty('labelGetter')) {
             $label = $this->getValue('labelGetter');
         } else {
             $label = $this->getPropertyValue('label', 'Undefined');
         }
         return content_tag('a', $label, $linkAttributes) . $this->getHiddenFieldHTML();
     } else {
         return $this->toValue() . $this->getHiddenFieldHTML();
     }
 }
 /**
  * Initializes the current sfGenerator instance.
  *
  * @param sfGeneratorManager $generatorManager A sfGeneratorManager instance
  */
 public function initialize(sfGeneratorManager $generatorManager)
 {
     parent::initialize($generatorManager);
     $configuration = sfProjectConfiguration::getActive();
     $this->databaseManager = new sfDatabaseManager($configuration);
     $this->setGeneratorClass('sfDoctrineModule');
 }
Beispiel #14
0
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeIndex(sfWebRequest $request)
 {
     $this->user = $this->getUser();
     //$user_id = $_SESSION['symfony/user/sfUser/attributes']['symfony/user/sfUser/attributes']['user_id'];
     $user = $this->getUser()->getRaykuUser();
     if ($user) {
         $user_id = $user->getId();
     }
     if (!$user_id) {
         $this->forward('/dashboard');
     }
     $this->setVar('user_id', $user_id);
     //Form submitted
     if (sfWebRequest::POST == $this->getRequest()->getMethod()) {
         $emails = $this->getRequestParameter('emails');
         $ref = $this->getRequestParameter('ref');
         if (!$emails) {
             echo "Invalid emails";
             return false;
         }
         $mail = Mailman::createMailer();
         $mail->setContentType('text/html');
         $mail->addAddress($emails);
         $mail->setSubject('Invitation');
         sfProjectConfiguration::getActive()->loadHelpers(array('Asset', 'Url', 'Partial'));
         $mail->setBody(get_partial('invitationEmailHtml', array('ref' => $ref, 'user' => $user)));
         $mail->send();
         //$this->forward('referrals', 'invitesSent');
     }
 }
 /**
  * Initialize a sfDoctrineDatabase connection with the given parameters.
  *
  * <code>
  * $parameters = array(
  *    'name'       => 'doctrine',
  *    'dsn'        => 'sqlite:////path/to/sqlite/db');
  *
  * $p = new sfDoctrineDatabase($parameters);
  * </code>
  *
  * @param array $parameters  Array of parameters used to initialize the database connection
  * @return void
  */
 public function initialize($parameters = array())
 {
     parent::initialize($parameters);
     $dsn = $this->getParameter('dsn');
     $name = $this->getParameter('name');
     // Make sure we pass non-PEAR style DSNs as an array
     if (!strpos($dsn, '://')) {
         $dsn = array($dsn, $this->getParameter('username'), $this->getParameter('password'));
     }
     // Make the Doctrine connection for $dsn and $name
     $this->_doctrineConnection = Doctrine_Manager::connection($dsn, $name);
     $attributes = $this->getParameter('attributes', array());
     foreach ($attributes as $name => $value) {
         $this->_doctrineConnection->setAttribute($name, $value);
     }
     $encoding = $this->getParameter('encoding', 'UTF8');
     $eventListener = new sfDoctrineConnectionListener($this->_doctrineConnection, $encoding);
     $this->_doctrineConnection->addListener($eventListener);
     // Load Query Logger Listener
     if (sfConfig::get('sf_debug') && sfConfig::get('sf_logging_enabled')) {
         $this->_doctrineConnection->addListener(new sfDoctrineLogger());
     }
     // Invoke the configuration methods for the connection if they exist
     $configuration = sfProjectConfiguration::getActive();
     $method = sprintf('configureDoctrineConnection%s', ucwords($this->_doctrineConnection->getName()));
     if (method_exists($configuration, 'configureDoctrineConnection') && !method_exists($configuration, $method)) {
         $configuration->configureDoctrineConnection($this->_doctrineConnection);
     }
     if (method_exists($configuration, $method)) {
         $configuration->{$method}($this->_doctrineConnection);
     }
 }
 public function customize($params)
 {
     $params['moduleName'] = 'search';
     sfToolkit::clearDirectory(sfConfig::get('sf_app_cache_dir'));
     $generatorManager = new sfGeneratorManager(sfProjectConfiguration::getActive());
     sfGeneratorConfigHandler::getContent($generatorManager, 'xfGeneratorInterface', $params);
 }
    public function start($attributes = array())
    {
        if (sfConfig::get('app_parser_skip_toolbar')) {
            $attributes['toolbar'] = false;
            $attributes['north'] = false;
            $attributes['west'] = false;
        }
        /**
         * TOOLBAR
         */
        if (isset($attributes['toolbar']) && is_object($attributes['toolbar']) && get_class($attributes['toolbar']) == 'afExtjsToolbar') {
            $attributes['toolbar']->end();
        } elseif ((!isset($attributes['toolbar']) || isset($attributes['toolbar']) && $attributes['toolbar'] != false) && afExtjs::getInstance()->isDesktop() == false) {
            sfProjectConfiguration::getActive()->loadHelpers(array('afExtjsToolbar'));
        }
        /**
         * NORTH PANEL
         */
        if (isset($attributes['north']) && is_array($attributes['north'])) {
            $this->addPanel('north', $attributes['north']);
        } elseif (!isset($attributes['north']) || isset($attributes['north']) && $attributes['north'] != false) {
            $this->addPanel('north', array('id' => 'north_panel', 'region' => 'north', 'height' => '32', 'border' => false, 'bodyStyle' => 'background-color:#dfe8f6;'));
        }
        /**
         * WEST PANEL
         */
        if (isset($attributes['west']) && is_array($attributes['west'])) {
            $this->addPanel('west', $attributes['west']);
        } elseif (!isset($attributes['west']) || isset($attributes['west']) && $attributes['west'] != false) {
            $logoScript = "";
            if (class_exists('ConfigPeer')) {
                $avatarLogo = ConfigPeer::get("avatar_logo", false);
            } else {
                $avatarLogo = sfConfig::get('app_avatar_logo', false);
            }
            if ($avatarLogo && file_exists(sfConfig::get('sf_web_dir') . $avatarLogo)) {
                $imagesize = getimagesize(sfConfig::get('sf_web_dir') . $avatarLogo);
                $clickAction = 'onClick="var aboutWin = null;if(aboutWin = Ext.getCmp(\'about-window\')){aboutWin.show();aboutWin.center();}" style="cursor:pointer"';
                $logo = '<div style="background-color:#d9e7f8;border-right:1px solid #99bbe8;border-left:1px solid #99bbe8;border-bottom:1px solid #99bbe8; padding:2px 0px 0px 0px; margin:0px;text-align:center;"><img id="avatar_image" ' . $clickAction . ' src="' . $avatarLogo . '"/></div>';
                $logoScript = 'var logoDiv = Ext.DomHelper.insertBefore(comp.bwrap,{tag:"div",html:"' . addslashes($logo) . '"});			
				var resize = function(comp){
					var body = comp.body, bodyHeight = body.getHeight();
					body.setHeight(bodyHeight-' . $imagesize[1] . '-3);					
				}; 
				resize(comp); 
				comp.on("bodyresize",function(comp,w,h){resize(comp);});';
            }
            $attributes_temp = array('id' => 'west_panel', 'stateful' => true, 'stateEvents' => array('afterlayout'), 'getState' => $this->afExtjs->asMethod(array("parameters" => "", "source" => "return { activeItemIndex: this.items.findIndex('id',this.layout.activeItem.id) };")), 'stateId' => 'west_panel', 'region' => 'west', 'title' => 'Navigation', 'width' => '255', 'minWidth' => '255', 'split' => 'true', 'layoutConfig' => array('animate' => 'true'), 'collapsible' => 'true', 'layout' => 'accordion', 'listeners' => '{"beforerender": function(){var state=Ext.state.Manager.get("west_panel");if(!state){this.activeItem = this.findById("profile");}else{this.activeItem = state.activeItemIndex;}},"render":function(comp){' . $logoScript . '}}');
            if (!isset($this->attributes['viewport']['west_panel'])) {
                $this->attributes['viewport']['west_panel'] = $attributes_temp;
            } else {
                $this->attributes['viewport']['west_panel'] = array_merge($attributes_temp, $this->attributes['viewport']['west_panel']);
            }
            unset($attributes_temp);
        } elseif (isset($attributes['west']) && $attributes['west'] == false) {
            $this->attributes['viewport']['west_panel'] = false;
        }
        parent::start($attributes);
    }
Beispiel #18
0
 public function executeSelect(sfWebRequest $request)
 {
     if ($request->isXmlHttpRequest()) {
         // steps 1-3 requests & restart
         $this->setLayout(false);
         sfProjectConfiguration::getActive()->loadHelpers('Partial');
         $agent = new CircuitBreakerSelectionAgent($request->getGetParameters());
         if ($data = $agent->executeStep()) {
             $partial = 'filter' . ucfirst($request->getParameter('step')) . 'Step';
             $html = get_partial($partial, array('selection' => $request->getParameter($request->getParameter('step'), NULL), 'back_qs' => $data['back_qs'], 'data' => $data['data'], 'results_so_far' => $data['results_so_far'], 'search_params' => $agent->getSearchParameters()));
         } else {
             /*
              * Would only get here if LWS DB is incomplete.
              * In this case we need to use the query string to retrieve the relevant
              * data set from teh DB and then fill in the missing values.
              * 
              * Do not throw 404 from Ajax request, 
              * just send error messgae back to user.
              * 
              * !! I should log the query string in these cases to facilitate
              * updating of DB.
              */
             $html = "<p id='tech_prob'>Sorry, we our experiencing technical difficulties. Please contact technical support at <a href='mailto:webmaster@livewiresupply.com'>webmaster@livewiresupply.com</a></p>";
         }
         $response = $this->getResponse();
         $response->addCacheControlHttpHeader('no-cache');
         $response->setContentType('text/html');
         $response->sendHttpHeaders();
         return $this->renderText($html);
     } else {
         // ONLY FOR VOLTS/LAST STEP, or graceful degradation for non JavaScript enabled browsers
         $this->manuf_slug = LWS::getManufSlug($request->getParameter('manuf_id'));
         $this->manuf = LWS::unslugify($this->manuf_slug, true);
         $template = 'Filter' . ucfirst($request->getParameter('step')) . 'Step';
         $this->selection = $request->getParameter($request->getParameter('step'));
         $agent = new CircuitBreakerSelectionAgent($request->getGetParameters());
         /*
          * $agent would not return data only if LWS DB is incomplete.
          * Sequence of steps dictate that once LWS DB is complete,
          * server should throw a 404.  User may have be url surfing.
          * 
          * !!! be sure to update DB if necessary.
          */
         $this->forward404Unless($this->data = $agent->executeStep());
         if ($request->getParameter('step') == 'volts') {
             $this->redirect("@part?cat_slug=circuit-breakers&manuf_slug={$this->manuf_slug}&part_no=" . LWS::encode($this->data[0]['part']['part_no']));
         } else {
             // remove unecessary ajax 'back a step' query string from end of data array
             unset($this->data['back_qs']);
             $this->results_so_far = $this->data['results_so_far'];
             $this->data = $this->data['data'];
             $this->search_params = $agent->getSearchParameters();
             $response = $this->getResponse();
             $response->setTitle("{$this->manuf} Circuit Breakers Selection Process");
             $response->setSlot('body_class', 'cb_manuf');
             return $template;
         }
     }
 }
 public function getShortcuts()
 {
     if (is_readable(sfConfig::get('sf_app_lib_dir') . '/helper/afExtjsDesktopLinksHelper.php')) {
         sfProjectConfiguration::getActive()->loadHelpers(array('afExtjsDesktopLinks'));
     } else {
         sfProjectConfiguration::getActive()->loadHelpers(array('afExtjsDesktopLinksDefault'));
     }
 }
Beispiel #20
0
 public function configure()
 {
     sfProjectConfiguration::getActive()->loadHelpers(array('Asset', 'Thumb'));
     unset($this['created_at'], $this['updated_at']);
     $this->widgetSchema['logo'] = new sfWidgetFormInputFileEditable(array('file_src' => doThumb($this->getObject()->getLogo(), 'partenaires', array('width' => 150, 'height' => 150), 'scale'), 'is_image' => true, 'edit_mode' => !$this->isNew() && $this->getObject()->getLogo(), 'with_delete' => true, 'delete_label' => "Supprimer ce logo"));
     $this->validatorSchema['logo'] = new sfValidatorFileImage(array('required' => false, 'path' => sfConfig::get('sf_upload_dir') . '/partenaires/source', 'mime_types' => 'web_images', 'max_width' => 1000, 'max_height' => 1000));
     $this->validatorSchema['logo_delete'] = new sfValidatorBoolean();
 }
 /**
  * Constructor.
  *
  * @param sfEventDispatcher $dispatcher
  */
 public function __construct(sfEventDispatcher $dispatcher = null)
 {
     if (null === $dispatcher) {
         $this->dispatcher = sfProjectConfiguration::getActive()->getEventDispatcher();
     } else {
         $this->dispatcher = $dispatcher;
     }
 }
 public function end()
 {
     $this->addSouthComponent();
     if (!sfConfig::get('app_parser_skip_west')) {
         sfProjectConfiguration::getActive()->loadHelpers(array('afExtjsWest'));
     }
     parent::end();
 }
Beispiel #23
0
 public function configure()
 {
     $years = range(date('Y') - 100, date('Y') + 5);
     //Creates array of years between 1920-2000
     $years_list = array_reverse(array_combine($years, $years), true);
     //Creates new array where key and value are both values from $years list
     sfProjectConfiguration::getActive()->loadHelpers('Global');
     unset($this['created_at'], $this['updated_at'], $this['clearance'], $this['keys_returned'], $this['email_removed'], $this['server_removed'], $this['dist_list_removed']);
     $this->widgetSchema['dob'] = new sfWidgetFormJQueryDate(array('years' => $years_list, 'image' => '/images/calendar.png', 'config' => '{changeYear:true, yearRange: \'1920:2009\'}'), array('class' => 'date'));
     $this->widgetSchema['license_expiration'] = new sfWidgetFormJQueryDate(array('years' => $years_list, 'image' => '/images/calendar.png', 'image' => '/images/calendar.png', 'config' => '{}'), array('class' => 'date'));
     $this->widgetSchema['doh'] = new sfWidgetFormJQueryDate(array('years' => $years_list, 'image' => '/images/calendar.png', 'config' => '{}'), array('class' => 'date'));
     $this->widgetSchema['physical_date'] = new sfWidgetFormJQueryDate(array('years' => $years_list, 'image' => '/images/calendar.png', 'config' => '{}'), array('class' => 'date'));
     $this->widgetSchema['tb_date'] = new sfWidgetFormJQueryDate(array('years' => $years_list, 'image' => '/images/calendar.png', 'config' => '{}'), array('class' => 'date'));
     $this->widgetSchema['osha_date'] = new sfWidgetFormJQueryDate(array('years' => $years_list, 'image' => '/images/calendar.png', 'config' => '{}'), array('class' => 'date'));
     $this->widgetSchema['cpr_date'] = new sfWidgetFormJQueryDate(array('years' => $years_list, 'image' => '/images/calendar.png', 'config' => '{}'), array('class' => 'date'));
     $this->widgetSchema['dof'] = new sfWidgetFormJQueryDate(array('years' => $years_list, 'image' => '/images/calendar.png', 'config' => '{}'), array('class' => 'date'));
     $this->widgetSchema['tc_effective'] = new sfWidgetFormJQueryDate(array('years' => $years_list, 'image' => '/images/calendar.png', 'config' => '{}'), array('class' => 'date'));
     $this->widgetSchema['tc_exp'] = new sfWidgetFormJQueryDate(array('years' => $years_list, 'image' => '/images/calendar.png', 'config' => '{}'), array('class' => 'date'));
     $this->widgetSchema['tc_type'] = new sfWidgetFormChoice(array('expanded' => false, 'multiple' => false, 'choices' => EmployeePeer::getTcTypeOptions()));
     $this->validatorSchema['tc_type'] = new sfValidatorChoice(array('required' => false, 'multiple' => false, 'choices' => array_keys(EmployeePeer::getTcTypeOptions())));
     $this->widgetSchema['employee_to_location_list']->setOption('expanded', true);
     $this->widgetSchema['employee_finger_to_location_list']->setOption('expanded', true);
     $this->widgetSchema['tc_type']->setLabel('Teacher Cert. Type');
     $this->widgetSchema['tc_effective']->setLabel('Teacher Cert. Effective');
     $this->widgetSchema['tc_number']->setLabel('Teacher Cert. Number');
     $this->widgetSchema['tc_exp']->setLabel('Cert. Through (expires)');
     $this->widgetSchema['has_dist_list']->setLabel('On distribution list');
     // $this->widgetSchema['clearance']->setLabel('SCR Clearance');
     $this->widgetSchema['first_name']->setLabel('First Name');
     $this->widgetSchema['last_name']->setLabel('Last Name');
     $this->widgetSchema['job_id']->setLabel('Job Title');
     $this->widgetSchema['home_phone']->setLabel('Home Phone');
     $this->widgetSchema['cell_phone']->setLabel('Cell Phone');
     $this->widgetSchema['company_email']->setLabel('Company Email');
     $this->widgetSchema['personal_email']->setLabel('Personal Email');
     $this->widgetSchema['zip']->setLabel('ZIP');
     $this->widgetSchema['ssn']->setLabel('SSN');
     $this->widgetSchema['npi']->setLabel('NPI');
     $this->widgetSchema['doh']->setLabel('Date of Hire');
     $this->widgetSchema['dof']->setLabel('Date of Termination');
     $this->widgetSchema['dob']->setLabel('DOB');
     $this->widgetSchema['license_number']->setLabel('License Number');
     $this->widgetSchema['license_expiration']->setLabel('License Expires');
     $this->widgetSchema['physical_date']->setLabel('Physical Expiration Date');
     $this->widgetSchema['physical_notes']->setLabel('Physical Notes');
     $this->widgetSchema['tb_date']->setLabel('TB Expiration Date');
     $this->widgetSchema['tb_notes']->setLabel('TB Notes');
     $this->widgetSchema['osha_date']->setLabel('OSHA Expiration Date');
     $this->widgetSchema['cpr_date']->setLabel('CPR Expiration Date');
     $this->widgetSchema['suplimental_health']->setLabel('Supplemental health');
     $this->widgetSchema['employee_finger_to_location_list']->setLabel('Fingerprints');
     $this->widgetSchema['finger_print_notes']->setLabel('Fingerprint Notes');
     $this->widgetSchema['employee_to_location_list']->setLabel('SCR Clearance');
     $this->widgetSchema['picture'] = new sfWidgetFormInputFileEditable(array('label' => 'Picture', 'file_src' => '/uploads/' . sfConfig::get('app_employee_images_dir', 'employee') . '/' . $this->getObject()->getPicture(), 'is_image' => false, 'edit_mode' => !$this->isNew(), 'template' => '<div><label>Delete the picture?</label> %delete%<br /><label>New Picture</label> %input%</div>'));
     $this->validatorSchema['picture'] = new sfValidatorFile();
     $this->validatorSchema['picture']->setOption('required', false);
     $this->validatorSchema['picture_delete'] = new sfValidatorBoolean();
 }
 function getUserLink($userId = null)
 {
     if (is_null($userId)) {
         $userId = $this->getUserId();
     }
     sfProjectConfiguration::getActive()->loadHelpers(array('Tag', 'Url'));
     $user = UserPeer::retrieveByPK($userId);
     return !$user ? '<i>Deleted account</i>' : link_to($user->getUsername(), '@profile?username=' . $user->getUsername());
 }
Beispiel #25
0
 public function executeUrl(sfWebRequest $request)
 {
     sfProjectConfiguration::getActive()->loadHelpers('Url');
     $urls = array();
     if ($module = $request->getParameter('key')) {
         $urls = $this->loadUrls($module);
     }
     $this->urls = implode("," . PHP_EOL, $urls);
 }
 public function filterGet(Doctrine_Record $record, $name)
 {
     $method = 'get' . sfInflector::camelize($name);
     $event = sfProjectConfiguration::getActive()->getEventDispatcher()->notifyUntil(new sfEvent($record, 'sympal.' . $this->_eventName . '.method_not_found', array('method' => $method)));
     if ($event->isProcessed()) {
         return $event->getReturnValue();
     }
     throw new Doctrine_Record_UnknownPropertyException(sprintf('Unknown record property / related component "%s" on "%s"', $name, get_class($record)));
 }
 /**
  * Method for building display of an item on pagination lists.
  * Currently just calles symfony template after building up some
  * parameters to pass along.  Might not be most effecient method.
  * I think building an html string would be better on resources,
  * but a pain to construct, even as a HEREDOC.
  * @param Array $part, passed by reference for updating/appending
  * @param Array $specs_preview_fields, the fields most relevant for the current part category
  */
 public function buildDisplay(&$part, $specs_preview_fields)
 {
     // load 'Partial' helper from symfony library
     sfProjectConfiguration::getActive()->loadHelpers('Partial');
     //$cat_singular = LWS::getCategoryName($part['cat_slug'], true);
     $part['anchor_text'] = "{$part['part_no']}";
     // might want to change it for seo reasons, etc.
     $part['layout'] = get_partial('toolkit/basicListDisplay', array('part' => $part, 'display' => $part['display'], 'specs_preview_fields' => $specs_preview_fields));
 }
 /**
  * @param  string $name        The element name
  * @param  string $value       The value displayed in this widget
  * @param  array  $attributes  An array of HTML attributes to be merged with the default HTML attributes
  * @param  array  $errors      An array of errors for the field
  *
  * @return string An HTML tag string
  *
  * @see sfWidgetFormInput
  */
 public function render($name, $value = null, $attributes = array(), $errors = array())
 {
     sfProjectConfiguration::getActive()->loadHelpers('sfAsset');
     init_asset_library();
     $html = parent::render($name, $value, $attributes, $errors) . '&nbsp;';
     $attributes = $this->fixFormId(array('name' => $name));
     $html .= input_sf_asset_image_tag($name, array('id' => $attributes['id'], 'type' => $this->getOption('asset_type')));
     return $html;
 }
Beispiel #29
0
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeSignin(sfWebRequest $request)
 {
     // redirect if user is already logged in
     if ($this->getUser()->isAuthenticated()) {
         $this->redirect("@widget_like");
     }
     sfProjectConfiguration::getActive()->loadHelpers('I18N');
     $this->getUser()->setFlash('headline', __('Settings', null, 'widget'));
 }
 public function getSlotValue($slot, $settings)
 {
     sfProjectConfiguration::getActive()->loadHelpers('sfAsset');
     $asset_id = $slot->getOption('asset_id', null, $settings['culture']);
     $asset = empty($asset_id) ? new sfAsset() : sfAssetPeer::retrieveFromUrl($asset_id);
     if (!$asset) {
         $asset = new sfAsset();
     }
     return asset_image_tag($asset, $asset->isNew() ? 'small' : 'full') . ($asset->getDescription() != '' ? content_tag('span', $asset->getDescription(), 'class=desc') : null);
 }