Beispiel #1
0
    /**
     * Helper main function
     * @return String HTML to be inserted in the view
     */
    public function EditorText()
    {
        $pathToConfigStyles = Sydney_Tools::getLocalPath() . '/config/ckeditor.styles.ini';
        $pathToConfigJsTemplate = Sydney_Tools::getLocalPath() . '/config/ckeditor.jstemplate.ini';
        $toReturn = '<script>
                            var publicCss = "' . Zend_Registry::get("config")->ckeditor->css . '";' . '</script><!-- ' . $pathToConfigStyles . ' -->';
        if (file_exists($pathToConfigStyles) && ($contentStyles = file_get_contents($pathToConfigStyles))) {
            $addStyleCss = '<script> var addStyleCss = ' . $contentStyles . ';</script>';
        } else {
            $addStyleCss = '<script> var addStyleCss = false;</script>';
        }
        if (file_exists($pathToConfigJsTemplate) && ($contentTemplate = file_get_contents($pathToConfigJsTemplate))) {
            $toReturn .= '<script type="text/javascript">' . $contentTemplate . '</script>';
        }
        $toReturn .= $addStyleCss . '<div class="editor text-block sydneyeditor" data-content-type="text-block">
					<textarea class="texteditor">

					</textarea>
					<p class="buttons sydney_editor_p">
						<a class="button sydney_editor_a" href="save">' . Sydney_Tools_Localization::_('Save as actual content') . '</a> <a class="button sydney_editor_a" href="save-draft">' . Sydney_Tools_Localization::_('Save as draft') . '</a>
						<a class="button muted sydney_editor_a" href="cancel">' . Sydney_Tools_Localization::_('Cancel') . '</a>
					</p>
				</div>';
        return $toReturn;
    }
Beispiel #2
0
 public static function getContentLanguages()
 {
     if (!is_array(self::$authContentLanguages)) {
         self::$authContentLanguages = explode(',', Zend_Registry::get('config')->general->content->languages->list);
     }
     return self::$authContentLanguages;
 }
    /**
     * Helper main function
     * @return String HTML to be inserted in the view
     */
    public function EditorViewembeder()
    {
        $toReturn = '<div class="editor view-embedder-block" data-content-type="view-embedder-block">
					<p class="sydney_editor_p">' . Sydney_Tools_Localization::_('View path') . ' <input class="value sydney_editor_input" type="text" value="" style="width:300px;" /></p>
					<p class="buttons sydney_editor_p"><a class="button sydney_editor_a" href="save">' . Sydney_Tools_Localization::_('Save as actual content') . '</a> <a class="button sydney_editor_a" href="save-draft">' . Sydney_Tools_Localization::_('Save as draft') . '</a> <a class="button muted sydney_editor_a" href="cancel">' . Sydney_Tools_Localization::_('Cancel') . '</a></p>
				</div>';
        return $toReturn;
    }
Beispiel #4
0
 /**
  *
  */
 public function indexAction()
 {
     $this->setSubtitle(Sydney_Tools_Localization::_('Recent activity'));
     $this->setSideBar('index', 'dashboard');
     // get actyivity log
     $oActivity = new Safactivitylog();
     $this->view->activities = $oActivity->getLastActivities()->reorderingForDashboard();
     $this->render('index');
     $this->render('listactivities');
 }
Beispiel #5
0
 public function _($id, $defaultValue, $suffix = '')
 {
     if (!Sydney_Tools_Localization::isMultiLanguageContentActive()) {
         return $defaultValue;
     }
     $keyLabel = $id . '_' . $this::TABLE_NAME . (empty($suffix) ? '' : '_' . $suffix);
     $translation = $this->getTranslate()->_($keyLabel);
     if ($keyLabel === $translation || Sydney_Tools_Localization::getCurrentContentLanguage() === Sydney_Tools_Localization::getDefaultContentLanguage()) {
         return $defaultValue;
     }
     return $translation;
 }
Beispiel #6
0
    /**
     * Helper main function
     * @return String HTML to be inserted in the view
     */
    public function EditorHeading()
    {
        $toReturn = '<div class="editor heading-block" data-content-type="heading-block">
					<p class="sydney_editor_p"><input class="value" type="text" value="" /></p>
					<p class="radiogroup sydney_editor_p">
						<label class="sydney_editor_label"><input class="sydney_editor_input" id="f_heading" name="level" type="radio" value="1"/> ' . Sydney_Tools_Localization::_('Heading') . '</label>
						<label class="sydney_editor_label"><input class="sydney_editor_input" id="f_subheading" name="level" type="radio" value="2"/> ' . Sydney_Tools_Localization::_('Sub heading') . '</label>
						<label class="sydney_editor_label"><input class="sydney_editor_input" id="f_minorheading" name="level" type="radio" value="3"/> ' . Sydney_Tools_Localization::_('Minor heading') . ' (3)</label>
						<label class="sydney_editor_label"><input class="sydney_editor_input" id="f_minorheading4" name="level" type="radio" value="4"/> ' . Sydney_Tools_Localization::_('Minor heading') . ' (4)</label>
						<label class="sydney_editor_label"><input class="sydney_editor_input" id="f_minorheading5" name="level" type="radio" value="5"/> ' . Sydney_Tools_Localization::_('Minor heading') . ' (5)</label>
						<label class="sydney_editor_label"><input class="sydney_editor_input" id="f_minorheading6" name="level" type="radio" value="6"/> ' . Sydney_Tools_Localization::_('Minor heading') . ' (6)</label>
					</p>
					<p class="buttons sydney_editor_p"><a class="button sydney_editor_a" href="save">Save as actual content</a> <a class="button sydney_editor_a" href="save-draft">' . Sydney_Tools_Localization::_('Save as draft') . '</a>  <a class="button muted sydney_editor_a" href="cancel">' . Sydney_Tools_Localization::_('Cancel') . '</a></p>
				</div>';
        return $toReturn;
    }
Beispiel #7
0
 /**
  *
  * Helper for displaying tabs and buttons in a sidebar in sydney admin
  *
  * @param Array $m Array of actions and their labels to show in the tabs
  * @param String $exceptAction Label of an action where we should not show the add button (like an index -> dashboard for example)
  * @param String $cdn The CDN to be used
  * @param String $moduleName The name of the module
  * @param String $controllerName The name of the Controller
  * @param String $actionName The name of the current action (to highlight the tab)
  * @return String The resulting HTML
  */
 public function SideTabs($m, $exceptAction, $cdn, $moduleName, $controllerName, $actionName, $parameters = false)
 {
     $s = $actionName;
     if (!isset($m[$s])) {
         foreach ($m as $k => $v) {
             //if (preg_match('/'.$k.'/', $s)) {
             if ($k == $s || $k == substr($s, 4)) {
                 // substr: 4 for prefix edit
                 $s = $k;
                 break;
             }
         }
     }
     $html = '';
     if ($exceptAction != '_ALL_') {
         if ($actionName != $exceptAction && isset($m[$actionName])) {
             $html .= '<div class="actions clearfix"><a class="bigbutton" href="/' . $moduleName . '/' . $controllerName . '/edit' . $actionName . '/?forModule=' . $_GET['forModule'] . '"><img src="' . $cdn . '/sydneyassets/images/ui/bigbutton/icon_add.png" /> Add ' . Sydney_Tools_Localization::_($m[$actionName]) . '</a></div>';
         } elseif ($actionName != $exceptAction) {
             $html .= '<div class="actions clearfix"><a href="/' . $moduleName . '/' . $controllerName . '/' . $s . '/" class="bigbutton muted">Back to ' . Sydney_Tools_Localization::_($m[$s]) . '</a></div>';
         }
     }
     $html .= '<hr /><ul id="localnav" class="clearfix">';
     foreach ($m as $k => $v) {
         if (preg_match('/^sep[0-9]{0,5}$/', $k)) {
             $html .= '</ul><div class="pod"><h2>' . Sydney_Tools_Localization::_($v) . '</h2></div><ul id="localnav" class="clearfix">';
         } else {
             $stro = array('', '');
             if ($s == $k) {
                 $stro = array('<strong>', '</strong>');
             }
             $html .= '<li>' . $stro[0] . '<a href="/' . $moduleName . '/' . $controllerName . '/' . $k . '">' . Sydney_Tools_Localization::_($v) . '</a>' . $stro[1] . '</li>';
         }
     }
     $html .= '</ul>';
     if ($parameters) {
         $html .= '<div class="pod"><h2></h2></div><ul  id="localnav" class="clearfix">';
         $html .= '<li><a href="/adminparameters/index/parameters?forModule=' . $moduleName . '">Parameters</a></li>';
         $html .= '</ul>';
     }
     return $html;
 }
Beispiel #8
0
 /**
  * Langue settings for the current session
  */
 public function setLanguageSettings()
 {
     $settingsNms = new Zend_Session_Namespace('appSettings');
     // Init Content language
     if (Sydney_Tools_Localization::isMultiLanguageContentActive()) {
         // Define Content language
         // set language to what we found in the $_GET['clang']
         if (isset($_GET['clang']) && in_array($_GET['clang'], Sydney_Tools_Localization::getContentLanguages())) {
             // set lang code in the session
             $settingsNms->ContentLanguage = $_GET['clang'];
             // Clear cache
             $cache = $this->registry->get('cache');
             $cache->clean(Zend_Cache::CLEANING_MODE_ALL);
         } elseif (!isset($settingsNms->ContentLanguage)) {
             // OR set language from the config file
             $settingsNms->ContentLanguage = Sydney_Tools_Localization::getDefaultContentLanguage();
         }
     }
     // set language to what we found in the $_GET['slang']
     if (isset($_GET['slang'])) {
         // set lang code in the session
         $settingsNms->ApplicationLanguage = $_GET['slang'];
         // no idea what that is
         if (isset($_GET['slangexit']) && $_GET['slangexit'] == 1) {
             exit;
         }
     } elseif (!isset($settingsNms->ApplicationLanguage)) {
         $settingsNms->ApplicationLanguage = $this->config->general->lang;
     }
     // sets the lang from session to local var
     if (isset($settingsNms->ApplicationLanguage)) {
         $this->requestLang = $settingsNms->ApplicationLanguage;
     }
 }
Beispiel #9
0
 /**
  * Standard email form for all webinstances
  * @since 23 aug 2013
  */
 public function emailAction()
 {
     $r = $this->getRequest();
     $form = new PubcontactFormOp(null, $r->getParams());
     $form->setMethod('post');
     $purl = $this->_buildUrlFromParams($r->getParams());
     if ($purl === '') {
         $purl = '/publicms/forms/email/';
     }
     $currentLangCode = $this->getCurrentLangCode();
     $purl .= !empty($currentLangCode) ? '?slang=' . $currentLangCode : '';
     $purl .= '#pubcontact';
     $form->setAction($purl);
     if ($r->isPost()) {
         $p = $this->_flattenForemailForm($r->getParams());
         $form->populate($p);
         if ($form->isValid($p)) {
             $db = new Pubcontact();
             $dbRow = $db->createRow();
             // $dbRow->id = '';
             $dbRow->safinstances_id = Sydney_Tools_Sydneyglobals::getSafinstancesId();
             $dbRow->datetime = date('Y-m-d H:i:s');
             // $dbRow->timestamp = '';
             if (isset($p['fname'])) {
                 $dbRow->fname = $p['fname'];
             }
             if (isset($p['lname'])) {
                 $dbRow->lname = $p['lname'];
             }
             if (isset($p['fullname'])) {
                 $dbRow->fullname = $p['fullname'];
             }
             if (isset($p['email'])) {
                 $dbRow->email = $p['email'];
             }
             if (isset($p['phonenr'])) {
                 $dbRow->phonenr = $p['phonenr'];
             }
             if (isset($p['subject'])) {
                 $dbRow->subject = $p['subject'];
             }
             if (isset($p['message'])) {
                 $dbRow->message = $p['message'];
             }
             if (isset($p['subsnewsletter'])) {
                 $dbRow->subsnewsletter = $p['subsnewsletter'];
             }
             // upload the file if any
             $dbRow->filfiles_id = 0;
             if (isset($p['MAX_FILE_SIZE'])) {
                 if ($form->uploadfile->receive()) {
                     $filefilesDb = new FilfilesOp();
                     $fileData = $filefilesDb->fileToFileManager($form->uploadfile->getFileName(), date('d/m/Y H:i:s') . ' file uploaded from FORMMAIL - Author : ' . $dbRow->fname . ' ' . $dbRow->lname . ' ' . $dbRow->fullname, 'Formmail');
                     $dbRow->filfiles_id = $fileData;
                 } else {
                     Zend_Debug::dump('ERROR: The file could not be uploaded...');
                 }
             }
             $entId = $dbRow->save();
             if ($entId !== false) {
                 $this->view->confirmSent = true;
                 $this->view->form = Sydney_Tools_Localization::_('Thanks, your message has been sent.');
                 // send the mail
                 if ($this->_sendEmailForms($p['emails'], $dbRow)) {
                     Sydney_Db_Trace::add('trace.event.emailsent_emailform' . ' [' . $dbRow->email . ']', 'publicms', 'pubcontact', 'email', $entId);
                 } else {
                     Sydney_Db_Trace::add('trace.event.emailerror_emailform' . ' [' . $dbRow->email . ']', 'publicms', 'pubcontact', 'email', $entId);
                 }
             } else {
                 $this->view->form = $form;
             }
         } else {
             $this->view->form = $form;
         }
     } else {
         $this->view->form = $form;
     }
 }