public function execute($request)
 {
     // loop through application settings and extract enabled i18n languages
     foreach (sfConfig::getAll() as $setting => $value) {
         if (0 === strpos($setting, 'app_i18n_languages')) {
             $enabledI18nLanguages[$value] = format_language($value, $value);
         }
     }
     // sort languages by alpha code to look pretty
     ksort($enabledI18nLanguages);
     $this->enabledI18nLanguages = $enabledI18nLanguages;
 }
<?php

echo format_language($schema_property_element_history->getLanguage());
?>
      </ul>
    </td>

    <td class="details_lang">
      <h3><?php 
echo __('Language');
?>
 :</h3>
      <ul>
      <?php 
foreach ($item->PeopleLanguages as $lang) {
    ?>
	  <li>
	    <?php 
    echo format_language($lang->getLanguageCountry());
    ?>
 
	    <?php 
    if ($lang->getMother()) {
        ?>
	      <?php 
        echo __('(mother)');
        ?>
	    <?php 
    }
    ?>
	    <?php 
    if ($lang->getPreferredLanguage()) {
        ?>
	      <?php 
<?php

$languages = '';
if (is_array($vocabulary->getLanguages())) {
    foreach ($vocabulary->getLanguages() as $language) {
        $languages .= format_language($language) . ", ";
    }
    $languages = rtrim($languages, ", ");
}
echo $languages;
 /**
  * Gets the language
  *
  * @param string $culture
  *
  * @return string The formatted language
  */
 public function getFormatLanguage($culture = null)
 {
     return format_language(parent::getLanguage(), $culture);
 }
<h1><?php 
echo $article['title'];
?>
</h1>

<?php 
echo simple_format_text($article['content']);
?>

<ul>
<?php 
foreach (sfConfig::get('app_cultures_available', array()) as $lang) {
    ?>
  <li>
    <?php 
    echo format_language($lang);
    ?>
    <?php 
    echo link_to($article['Translation'][$lang]['title'], 'article', array('sf_subject' => $article['Translation'][$lang], 'sf_culture' => $lang));
    ?>
  </li>
<?php 
}
?>
</ul>

<h3>Comments</h3>

<ul id="comments">
<?php 
foreach ($article['Comments'] as $comment) {
 /**
  * Listens to the sympal.load_admin_menu to configure the admin menu
  */
 public function setupAdminMenu(sfEvent $event)
 {
     $menu = $event->getSubject();
     // Setup the Content menu
     $manageContent = $menu->getChild('content');
     $manageContent->setLabel('Content');
     $manageContent->addChild('Search', '@sympal_admin_search');
     $contentTypes = Doctrine_Core::getTable('sfSympalContentType')->getAllContentTypes();
     foreach ($contentTypes as $contentType) {
         $manageContent->addChild($contentType->getLabel(), '@sympal_content_list_type?type=' . $contentType->getId())->setCredentials(array('ManageContent'));
     }
     $manageContent->addChild('Slots', '@sympal_content_slots')->setCredentials(array('ManageSlots'));
     $manageContent->addChild('XML Sitemap', '@sympal_sitemap')->setCredentials(array('ViewXmlSitemap'));
     // Setup the Site Administration menu
     $siteAdministration = $menu->getChild('site_administration');
     $siteAdministration->setLabel('Site Administration');
     $siteAdministration->addChild('404 Redirects', '@sympal_redirects')->setCredentials(array('ManageRedirects'));
     $siteAdministration->addChild('Edit Site', '@sympal_sites_edit?id=' . sfSympalContext::getInstance()->getService('site_manager')->getSite()->getId())->setCredentials(array('ManageSites'));
     // Add to the Administration menu
     $administration = $menu->getChild('administration');
     $administration->addChild('Content Types', '@sympal_content_types')->setCredentials(array('ManageContentTypes'));
     $administration->addChild('Sites', '@sympal_sites')->setCredentials(array('ManageSites'));
     // Add a Content menu if applicable
     $content = $this->_sympalContext->getService('site_manager')->getCurrentContent();
     if ($content) {
         $contentEditor = $menu->getChild($content->getType()->slug);
         $contentEditor->setLabel(sprintf(__('%s Actions'), $content->getType()->getLabel()));
         // If in the admin, put a link to view the content
         if (sfSympalConfiguration::getActive()->isAdminModule()) {
             $contentEditor->addChild(sprintf(__('View %s'), $content->getType()->getLabel()), $content->getRoute());
         }
         $contentEditor->addChild(sprintf(__('Create New %s'), $content->getType()->getLabel()), '@sympal_content_create_type?type=' . $content['Type']['slug'])->setCredentials('ManageContent');
         $contentEditor->addChild(sprintf(__('Edit %s'), $content->getType()->getLabel()), $content->getEditRoute())->setCredentials('ManageContent');
         $contentEditor->addChild(__('Edit Content Type'), '@sympal_content_types_edit?id=' . $content->getType()->getId())->setCredentials('ManageMenus');
         // Add a menu item entry
         $menuItem = $this->_sympalContext->getService('menu_manager')->getCurrentMenuItem();
         if ($menuItem && $menuItem->exists()) {
             $contentEditor->addChild(__('Edit Menu Item'), '@sympal_content_menu_item?id=' . $content->getId())->setCredentials('ManageMenus');
         } else {
             $contentEditor->addChild(__('Add to Menu'), '@sympal_content_menu_item?id=' . $content->getId())->setCredentials('ManageMenus');
         }
         // Add publish/unpublish icons
         $user = sfContext::getInstance()->getUser();
         if ($user->hasCredential('PublishContent')) {
             if ($content->getIsPublished()) {
                 $contentEditor->addChild(__('Unpublish'), '@sympal_unpublish_content?id=' . $content->id, 'title=' . __('Published on %date%', array('%date%' => format_date($content->getDatePublished(), 'g'))) . '. ' . __('Click to unpublish content.'));
             } elseif ($content->getIsPublishInTheFuture()) {
                 $contentEditor->addChild(__('Unpublish'), '@sympal_unpublish_content?id=' . $content->id, 'title=' . __('Will publish on %date%', array('%date%' => format_date($content->getDatePublished(), 'g'))) . '. ' . __('Click to unpublish content.'));
             } else {
                 $contentEditor->addChild(__('Publish'), '@sympal_publish_content?id=' . $content->id, 'title=' . __('Has not been published yet. ' . __('Click to publish content.')));
             }
         }
         if (sfSympalConfig::isI18nEnabled()) {
             foreach (sfSympalConfig::getLanguageCodes() as $code) {
                 if (sfContext::getInstance()->getUser()->getEditCulture() != $code) {
                     $contentEditor->addChild(sprintf(__('Edit in %s'), format_language($code)), '@sympal_change_edit_language?language=' . $code, 'title=' . sprintf(__('Edit %s version'), format_language($code)));
                 }
             }
         }
     }
 }
<?php

$languagesOut = '';
/** @var $vocabulary_has_user VocabularyHasUser */
$languages = $vocabulary_has_user->getLanguages();
if (is_array($languages)) {
    foreach ($languages as $language) {
        $languagesOut .= format_language($language) . ", ";
    }
    $languagesOut = rtrim($languagesOut, ", ");
}
echo $languagesOut;
<?php

echo format_language($vocabulary->getLanguage());
Example #10
0
</span>
    <div class="label strings">
      <h2><?php 
echo __('Page text');
?>
</h2>
    </div>
    <div class="label source">
      <h2><?php 
echo __('Source');
?>
</h2>
    </div>
    <div class="label translation">
      <h2><?php 
echo __('%language% translation', array('%language%' => format_language($sf_user->getCulture())));
?>
</h2>
    </div>
  </div>
  <div id="l10n-client-string-select">
    <ul class="string-list">
      <?php 
foreach ($sf_data->getRaw('messages') as $source => $target) {
    ?>
        <li><?php 
    echo truncate_text(empty($target) ? $source : $target);
    ?>
</li>
      <?php 
}
foreach ($dc->format as $item) {
    ?>
  <?php 
    echo render_show(__('Format'), render_value($item));
}
?>

<?php 
echo render_show(__('Source'), render_value($resource->getLocationOfOriginals(array('cultureFallback' => true))));
?>

<?php 
foreach ($resource->language as $code) {
    ?>
  <?php 
    echo render_show(__('Language'), format_language($code));
}
?>

<?php 
echo render_show_repository(__('Relation (isLocatedAt)'), $resource);
?>

<?php 
foreach ($dc->coverage as $item) {
    ?>
  <?php 
    echo render_show(__('Coverage (spatial)'), link_to(render_title($item), array($item, 'module' => 'term', 'action' => 'browseTerm')));
}
?>
Example #12
0
      </tr>
    </thead>

    <tbody>
    <?php 
foreach ($i18nLanguages as $setting) {
    ?>
      <tr>
        <td>
          <?php 
    echo $setting->getName();
    ?>
        </td>
        <td>
          <?php 
    echo format_language($setting->getName());
    ?>
        </td>
        <td>
          <?php 
    if ($setting->deleteable) {
        ?>
            <?php 
        echo link_to(image_tag('delete'), array($setting, 'module' => 'settings', 'action' => 'delete'));
        ?>
          <?php 
    }
    ?>
        </td>
      </tr>
    <?php 
Example #13
0
 /**
  *
  * Function that returns the defualt language
  *
  * @param String $language, e.g. en_US, de_DE
  * @return String, formated in correct language, e.g. English, German
  */
 public static function buildDefaultLanguage($language) {
     sfLoader::loadHelpers('I18N');
     $result = array();
     $result = explode('_', $language);
     return format_language($result[0]);
 }
<?php

echo format_language($vocabulary_has_user->getDefaultLanguage());
<a class="menu" href="#"><?php 
echo __('Language');
?>
</a>

<ul>
  <?php 
foreach (sfConfig::getAll() as $name => $value) {
    ?>
    <?php 
    if ('app_i18n_languages' == substr($name, 0, 18)) {
        ?>
      <li<?php 
        if ($sf_user->getCulture() == $value) {
            ?>
 class="active"<?php 
        }
        ?>
><?php 
        echo link_to(format_language($value, $value), array('sf_culture' => $value) + $sf_request->getParameterHolder()->getAll());
        ?>
</li>
    <?php 
    }
    ?>
  <?php 
}
?>
</ul>
Example #16
0
        <ul>
          <?php 
    $nodes = $root->getBranch();
    ?>
          <?php 
    foreach ($nodes as $page_pk) {
        ?>
            <li class="<?php 
        echo $page_pk->getIsPublished() ? 'published' : 'unpublished';
        ?>
">
              <?php 
        foreach (sfPlop::get('sf_plop_cultures') as $localization) {
            ?>
                <?php 
            echo link_to(image_flag($localization, array('alt' => format_language($localization))), '@sf_plop_page_show?slug=' . $page_pk->getSlug() . '&sf_culture=' . $localization, array('class' => 'element flag w-img-link', 'title' => $page_pk->getSlug()));
            ?>
              <?php 
        }
        ?>
              <?php 
        echo link_to_unless($page->getSlug() == $page_pk->getSlug(), str_repeat('-', $page_pk->getLevel()) . ' ' . $page_pk->getSlug(), '@sf_plop_page_show?sf_culture=' . $culture . '&slug=' . $page_pk->getSlug(), array('class' => 'element', 'title' => $page_pk->getSlug()));
        ?>
              <?php 
        echo widgetIndicator($page_pk->isTemplate(), 'edit', __('This indicates if the page is a template (lock icon).', '', 'plopAdmin'), array('rel' => $page_pk->getSlug()));
        ?>
              <?php 
        echo widgetIndicator($page_pk->isPublished(), 'publish', __('This indicates if the page is published (green tick) or not (red bullet).', '', 'plopAdmin'), array('rel' => $page_pk->getSlug()));
        ?>
            </li>
          <?php 
 /**
  * Listens to sympal.load_config_form to load the configuration form
  */
 public function loadConfigForm(sfEvent $event)
 {
     $form = $event->getSubject();
     if (sfSympalConfig::isI18nEnabled()) {
         $cultures = sfCultureInfo::getCultures(sfCultureInfo::NEUTRAL);
         $languages = array();
         foreach ($cultures as $key => $value) {
             $formatted = format_language($value);
             if (!$formatted) {
                 $formatted = format_language($value, 'en');
             }
             if ($formatted) {
                 $languages[$value] = $formatted;
             }
         }
         asort($languages);
         $widget = new sfWidgetFormChoice(array('multiple' => true, 'choices' => $languages));
         $validator = new sfValidatorChoice(array('multiple' => true, 'choices' => array_keys($languages)));
         $form->addSetting(null, 'language_codes', 'Available Cultures', $widget, $validator);
         $languageForm = new sfFormLanguage(sfContext::getInstance()->getUser(), array('languages' => sfSympalConfig::getLanguageCodes()));
         $widgetSchema = $languageForm->getWidgetSchema();
         $validatorSchema = $languageForm->getValidatorSchema();
         $form->addSetting(null, 'default_culture', 'Default Culture', $widgetSchema['language'], $validatorSchema['language']);
     }
     $form->addSetting(null, 'default_rendering_module', 'Default Rendering Module');
     $form->addSetting(null, 'default_rendering_action', 'Default Rendering Action');
     $form->addSetting(null, 'breadcrumbs_separator', 'Breadcrumbs Separator');
     $form->addSetting(null, 'elastic_textareas', 'Elastic Textareas', 'InputCheckbox', 'Boolean');
     $form->addSetting(null, 'check_for_upgrades_on_dashboard', 'Check for Upgrades', 'InputCheckbox', 'Boolean');
     $form->addSetting('page_cache', 'enabled', 'Enabled?', 'InputCheckbox', 'Boolean');
     $form->addSetting('page_cache', 'super', 'Enable Super Cache?', 'InputCheckbox', 'Boolean');
     $form->addSetting('page_cache', 'with_layout', 'With layout?', 'InputCheckbox', 'Boolean');
     $form->addSetting('page_cache', 'lifetime', 'Lifetime');
 }
 public function import($xmlFile, $options = array())
 {
     // load the XML document into a DOMXML object
     $importDOM = $this->loadXML($xmlFile, $options);
     // if we were unable to parse the XML file at all
     if (empty($importDOM->documentElement)) {
         $errorMsg = sfContext::getInstance()->i18n->__('Unable to parse XML file: malformed or unresolvable entities');
         throw new Exception($errorMsg);
     }
     // if libxml threw errors, populate them to show in the template
     if ($importDOM->libxmlerrors) {
         // warning condition, XML file has errors (perhaps not well-formed or invalid?)
         foreach ($importDOM->libxmlerrors as $libxmlerror) {
             $xmlerrors[] = sfContext::getInstance()->i18n->__('libxml error %code% on line %line% in input file: %message%', array('%code%' => $libxmlerror->code, '%message%' => $libxmlerror->message, '%line%' => $libxmlerror->line));
         }
         $this->errors = array_merge((array) $this->errors, $xmlerrors);
     }
     if ('eac-cpf' == $importDOM->documentElement->tagName) {
         $this->rootObject = new QubitActor();
         $this->rootObject->parentId = QubitActor::ROOT_ID;
         $eac = new sfEacPlugin($this->rootObject);
         $eac->parse($importDOM);
         $this->rootObject->save();
         return $this;
     }
     // FIXME hardcoded until we decide how these will be developed
     $validSchemas = array('+//ISBN 1-931666-00-8//DTD ead.dtd Encoded Archival Description (EAD) Version 2002//EN' => 'ead', '-//Society of American Archivists//DTD ead.dtd (Encoded Archival Description (EAD) Version 1.0)//EN' => 'ead1', 'http://www.loc.gov/METS/' => 'mets', 'http://www.loc.gov/mods/' => 'mods', 'http://www.loc.gov/MARC21/slim' => 'marc', 'record' => 'oai_dc_record', 'dc' => 'dc', 'oai_dc:dc' => 'dc', 'dublinCore' => 'dc', 'metadata' => 'dc', 'ead' => 'ead', 'add' => 'alouette', 'http://www.w3.org/2004/02/skos/core#' => 'skos');
     // determine what kind of schema we're trying to import
     $schemaDescriptors = array($importDOM->documentElement->tagName);
     if (!empty($importDOM->namespaces)) {
         krsort($importDOM->namespaces);
         $schemaDescriptors = array_merge($schemaDescriptors, $importDOM->namespaces);
     }
     if (!empty($importDOM->doctype)) {
         $schemaDescriptors = array_merge($schemaDescriptors, array($importDOM->doctype->name, $importDOM->doctype->systemId, $importDOM->doctype->publicId));
     }
     foreach ($schemaDescriptors as $descriptor) {
         if (array_key_exists($descriptor, $validSchemas)) {
             $importSchema = $validSchemas[$descriptor];
         }
     }
     switch ($importSchema) {
         case 'ead':
             // just validate EAD import for now until we can get StrictXMLParsing working for all schemas in the self::LoadXML function. Having problems right now loading schemas.
             $importDOM->validate();
             // if libxml threw errors, populate them to show in the template
             foreach (libxml_get_errors() as $libxmlerror) {
                 $this->errors[] = sfContext::getInstance()->i18n->__('libxml error %code% on line %line% in input file: %message%', array('%code%' => $libxmlerror->code, '%message%' => $libxmlerror->message, '%line%' => $libxmlerror->line));
             }
             break;
         case 'skos':
             $criteria = new Criteria();
             $criteria->add(QubitSetting::NAME, 'plugins');
             $setting = QubitSetting::getOne($criteria);
             if (null === $setting || !in_array('sfSkosPlugin', unserialize($setting->getValue(array('sourceCulture' => true))))) {
                 throw new sfException(sfContext::getInstance()->i18n->__('The SKOS plugin is not enabled'));
             }
             $importTerms = sfSkosPlugin::parse($importDOM);
             $this->rootObject = QubitTaxonomy::getById(QubitTaxonomy::SUBJECT_ID);
             $this->count = count($importTerms);
             return $this;
             break;
     }
     $importMap = sfConfig::get('sf_app_module_dir') . DIRECTORY_SEPARATOR . 'object' . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'import' . DIRECTORY_SEPARATOR . $importSchema . '.yml';
     if (!file_exists($importMap)) {
         // error condition, unknown schema or no import filter
         $errorMsg = sfContext::getInstance()->i18n->__('Unknown schema or import format: "%format%"', array('%format%' => $importSchema));
         throw new Exception($errorMsg);
     }
     $this->schemaMap = sfYaml::load($importMap);
     // if XSLs are specified in the mapping, process them
     if (!empty($this->schemaMap['processXSLT'])) {
         // pre-filter through XSLs in order
         foreach ((array) $this->schemaMap['processXSLT'] as $importXSL) {
             $importXSL = sfConfig::get('sf_data_dir') . DIRECTORY_SEPARATOR . 'xslt' . DIRECTORY_SEPARATOR . $importXSL;
             if (file_exists($importXSL)) {
                 // instantiate an XSLT parser
                 $xslDOM = new DOMDocument();
                 $xslDOM->load($importXSL);
                 // Configure the transformer
                 $xsltProc = new XSLTProcessor();
                 $xsltProc->registerPHPFunctions();
                 $xsltProc->importStyleSheet($xslDOM);
                 $importDOM->loadXML($xsltProc->transformToXML($importDOM));
                 unset($xslDOM);
                 unset($xsltProc);
             } else {
                 $this->errors[] = sfContext::getInstance()->i18n->__('Unable to load import XSL filter: "%importXSL%"', array('%importXSL%' => $importXSL));
             }
         }
         // re-initialize xpath on the new XML
         $importDOM->xpath = new DOMXPath($importDOM);
     }
     // switch source culture if langusage is set in an EAD document
     if ($importSchema == 'ead') {
         if (is_object($langusage = $importDOM->xpath->query('//eadheader/profiledesc/langusage/language/@langcode'))) {
             $sf_user = sfContext::getInstance()->user;
             $currentCulture = $sf_user->getCulture();
             $langCodeConvertor = new fbISO639_Map();
             foreach ($langusage as $language) {
                 $isocode = trim(preg_replace('/[\\n\\r\\s]+/', ' ', $language->nodeValue));
                 // convert to Symfony culture code
                 if (!($twoCharCode = strtolower($langCodeConvertor->getID2($isocode)))) {
                     $twoCharCode = $isocode;
                 }
                 // Check to make sure that the selected language is supported with a Symfony i18n data file.
                 // If not it will cause a fatal error in the Language List component on every response.
                 ProjectConfiguration::getActive()->loadHelpers('I18N');
                 try {
                     format_language($twoCharCode, $twoCharCode);
                 } catch (Exception $e) {
                     $this->errors[] = sfContext::getInstance()->i18n->__('EAD "langmaterial" is set to') . ': "' . $isocode . '". ' . sfContext::getInstance()->i18n->__('This language is currently not supported.');
                     continue;
                 }
                 if ($currentCulture !== $twoCharCode) {
                     $this->errors[] = sfContext::getInstance()->i18n->__('EAD "langmaterial" is set to') . ': "' . $isocode . '" (' . format_language($twoCharCode, 'en') . '). ' . sfContext::getInstance()->i18n->__('Your XML document has been saved in this language and your user interface has just been switched to this language.');
                 }
                 $sf_user->setCulture($twoCharCode);
                 // can only set to one language, so have to break once the first valid language is encountered
                 break;
             }
         }
     }
     unset($this->schemaMap['processXSLT']);
     // go through schema map and populate objects/properties
     foreach ($this->schemaMap as $name => $mapping) {
         // if object is not defined or a valid class, we can't process this mapping
         if (empty($mapping['Object']) || !class_exists('Qubit' . $mapping['Object'])) {
             $this->errors[] = sfContext::getInstance()->i18n->__('Non-existent class defined in import mapping: "%class%"', array('%class%' => 'Qubit' . $mapping['Object']));
             continue;
         }
         // get a list of XML nodes to process
         $nodeList = $importDOM->xpath->query($mapping['XPath']);
         foreach ($nodeList as $domNode) {
             // create a new object
             $class = 'Qubit' . $mapping['Object'];
             $currentObject = new $class();
             // set the rootObject to use for initial display in successful import
             if (!$this->rootObject) {
                 $this->rootObject = $currentObject;
             }
             // if a parent path is specified, try to parent the node
             if (empty($mapping['Parent'])) {
                 $parentNodes = new DOMNodeList();
             } else {
                 $parentNodes = $importDOM->xpath->query('(' . $mapping['Parent'] . ')', $domNode);
             }
             if ($parentNodes->length > 0) {
                 // parent ID comes from last node in the list because XPath forces forward document order
                 $parentId = $parentNodes->item($parentNodes->length - 1)->getAttribute('xml:id');
                 unset($parentNodes);
                 if (!empty($parentId) && is_callable(array($currentObject, 'setParentId'))) {
                     $currentObject->parentId = $parentId;
                 }
             } else {
                 // orphaned object, set root if possible
                 if (is_callable(array($currentObject, 'setRoot'))) {
                     $currentObject->setRoot();
                 }
             }
             // go through methods and populate properties
             foreach ($mapping['Methods'] as $name => $methodMap) {
                 // if method is not defined, we can't process this mapping
                 if (empty($methodMap['Method']) || !is_callable(array($currentObject, $methodMap['Method']))) {
                     $this->errors[] = sfContext::getInstance()->i18n->__('Non-existent method defined in import mapping: "%method%"', array('%method%' => $methodMap['Method']));
                     continue;
                 }
                 // get a list of XML nodes to process
                 $nodeList2 = $importDOM->xpath->query($methodMap['XPath'], $domNode);
                 if (is_object($nodeList2)) {
                     switch ($name) {
                         // hack: some multi-value elements (e.g. 'languages') need to get passed as one array instead of individual nodes values
                         case 'languages':
                             $langCodeConvertor = new fbISO639_Map();
                             $value = array();
                             foreach ($nodeList2 as $nodeee) {
                                 if ($twoCharCode = $langCodeConvertor->getID2($nodeee->nodeValue)) {
                                     $value[] = strtolower($twoCharCode);
                                 } else {
                                     $value[] = $nodeee->nodeValue;
                                 }
                             }
                             $currentObject->language = $value;
                             break;
                         case 'flocat':
                             $resources = array();
                             foreach ($nodeList2 as $nodeee) {
                                 $resources[] = $nodeee->nodeValue;
                             }
                             if (0 < count($resources)) {
                                 $currentObject->importDigitalObjectFromUri($resources);
                             }
                             break;
                         default:
                             foreach ($nodeList2 as $domNode2) {
                                 // normalize the node text (trim whitespace manually); NB: this will strip any child elements, eg. HTML tags
                                 $nodeValue = trim(preg_replace('/[\\n\\r\\s]+/', ' ', $domNode2->nodeValue));
                                 // if you want the full XML from the node, use this
                                 $nodeXML = $domNode2->ownerDocument->saveXML($domNode2);
                                 // set the parameters for the method call
                                 if (empty($methodMap['Parameters'])) {
                                     $parameters = array($nodeValue);
                                 } else {
                                     $parameters = array();
                                     foreach ((array) $methodMap['Parameters'] as $parameter) {
                                         // if the parameter begins with %, evaluate it as an XPath expression relative to the current node
                                         if ('%' == substr($parameter, 0, 1)) {
                                             // evaluate the XPath expression
                                             $xPath = substr($parameter, 1);
                                             $result = $importDOM->xpath->query($xPath, $domNode2);
                                             if ($result->length > 1) {
                                                 // convert nodelist into an array
                                                 foreach ($result as $element) {
                                                     $resultArray[] = $element->nodeValue;
                                                 }
                                                 $parameters[] = $resultArray;
                                             } else {
                                                 // pass the node value unaltered; this provides an alternative to $nodeValue above
                                                 $parameters[] = $result->item(0)->nodeValue;
                                             }
                                         } else {
                                             // Confirm DOMXML node exists to avoid warnings at run-time
                                             if (false !== preg_match_all('/\\$importDOM->xpath->query\\(\'@\\w+\', \\$domNode2\\)->item\\(0\\)->nodeValue/', $parameter, $matches)) {
                                                 foreach ($matches[0] as $match) {
                                                     $str = str_replace('->nodeValue', '', $match);
                                                     if (null !== ($node = eval('return ' . $str . ';'))) {
                                                         // Substitute node value for search string
                                                         $parameter = str_replace($match, '\'' . $node->nodeValue . '\'', $parameter);
                                                     } else {
                                                         // Replace empty nodes with null in parameter string
                                                         $parameter = str_replace($match, 'null', $parameter);
                                                     }
                                                 }
                                             }
                                             eval('$parameters[] = ' . $parameter . ';');
                                         }
                                     }
                                 }
                                 // invoke the object and method defined in the schema map
                                 call_user_func_array(array(&$currentObject, $methodMap['Method']), $parameters);
                             }
                     }
                     unset($nodeList2);
                 }
             }
             // make sure we have a publication status set before indexing
             if ($currentObject instanceof QubitInformationObject && count($currentObject->statuss) == 0) {
                 $currentObject->setPublicationStatus(sfConfig::get('app_defaultPubStatus', QubitTerm::PUBLICATION_STATUS_DRAFT_ID));
             }
             // save the object after it's fully-populated
             $currentObject->save();
             // write the ID onto the current XML node for tracking
             $domNode->setAttribute('xml:id', $currentObject->id);
         }
     }
     return $this;
 }
<div style="text-align: center;">
  <?php 
echo image_tag('lock48');
?>

    <h2 style="font-size: 20px;"><?php 
echo __('Sorry, you do not have permission to make %1% language translations', array('%1%' => format_language($sf_user->getCulture())));
?>
</h2>

  <a href="javascript:history.go(-1)"><?php 
echo __('Back to previous page');
?>
</a>
  <br/>
  <?php 
echo link_to(__('Go to homepage'), '@homepage');
?>

</div>
Example #20
0
<?php

echo format_language($schema->getLanguage());
Example #21
0
<?php

echo format_language($concept_property->getLanguage());
 public function loadEditor(sfEvent $event)
 {
     $user = sfContext::getInstance()->getUser();
     $this->configuration->loadHelpers(array('Asset', 'Partial', 'I18N'));
     $menu = $event->getSubject();
     $content = $event['content'];
     $menuItem = $event['menuItem'];
     $sympalConfiguration = sfSympalConfiguration::getActive();
     $user = sfContext::getInstance()->getUser();
     $request = sfContext::getInstance()->getRequest();
     $contentEditor = $menu->getChild($content->getType()->getLabel() . ' Actions');
     if ($sympalConfiguration->isAdminModule()) {
         $contentEditor->addChild(__('View ') . $content->getType()->getLabel(), $content->getRoute());
     }
     $contentEditor->addChild(__('Create New ') . $content->getType()->getLabel(), '@sympal_content_create_type?type=' . $content['Type']['slug'])->setCredentials('ManageContent');
     $contentEditor->addChild(__('Edit ') . $content->getType()->getLabel(), $content->getEditRoute())->setCredentials('ManageContent');
     $contentEditor->addChild(__('Edit Content Type'), '@sympal_content_types_edit?id=' . $content->getType()->getId())->setCredentials('ManageMenus');
     if ($menuItem && $menuItem->exists()) {
         $contentEditor->addChild(__('Edit Menu Item'), '@sympal_content_menu_item?id=' . $content->getId())->setCredentials('ManageMenus');
     } else {
         $contentEditor->addChild(__('Add to Menu'), '@sympal_content_menu_item?id=' . $content->getId())->setCredentials('ManageMenus');
     }
     if (sfSympalConfig::isI18nEnabled()) {
         foreach (sfSympalConfig::getLanguageCodes() as $code) {
             if (sfContext::getInstance()->getUser()->getEditCulture() != $code) {
                 $contentEditor->addChild(__('Edit ') . format_language($code), '@sympal_change_edit_language?language=' . $code, 'title=' . __('Switch to ') . '' . format_language($code));
             }
         }
     }
     if ($user->hasCredential('PublishContent')) {
         if ($content->getIsPublished()) {
             $contentEditor->addChild(__('Unpublish'), '@sympal_unpublish_content?id=' . $content['id'], 'title=' . __('Published on %date%', array('%date%' => format_date($content->getDatePublished(), 'g'))) . '. ' . __('Click to unpublish content.'));
         } elseif ($content->getIsPublishInTheFuture()) {
             $contentEditor->addChild(__('Unpublish'), '@sympal_unpublish_content?id=' . $content['id'], 'title=' . __('Will publish on %date%', array('%date%' => format_date($content->getDatePublished(), 'g'))) . '. ' . __('Click to unpublish content.'));
         } else {
             $contentEditor->addChild(__('Publish'), '@sympal_publish_content?id=' . $content['id'], 'title=' . __('Has not been published yet. ' . __('Click to publish content.')));
         }
     }
 }
    if (in_array($skos, $skosProps)) {
        ?>
  <?php 
        $relatedConcept = $property->getConceptRelatedByRelatedConceptId();
        ?>
      <?php 
        echo $relatedConcept ? link_to($relatedConcept->getPrefLabel(), 'concept/show?id=' . $relatedConcept->getId()) : $property->getObject();
    } else {
        ?>
      <?php 
        echo $property->getObject();
    }
    ?>
    </td>
    <td><?php 
    $value = format_language($property->getLanguage());
    echo $value ? $value : '&nbsp;';
    ?>
</td>
    <td><?php 
    $value = $property->getStatus();
    echo $value ? $value : '&nbsp;';
    ?>
</td>
<?php 
    if ($sf_user->isAuthenticated()) {
        if ($sf_user->hasObjectCredential($sf_user->getCurrentVocabulary()->getId(), 'vocabulary', array(0 => array(0 => 'administrator', 1 => 'vocabularymaintainer', 2 => 'vocabularyadmin')))) {
            ?>
    <td>
      <ul class="sf_admin_td_actions">
        <li>
Example #24
0
<?php

$indices = array();
foreach ($engine->getIndices() as $name => $index) {
    $description = $index->describe();
    $indices[sprintf('%s', ucfirst(format_language($index->getCulture())))] = _tag('div.clearfix', _tag('span.fleft.s16.s16_file_text style=width:100px', $description['Documents'] . ' ' . __('Pages')) . _tag('span.fleft', $description['Size']));
}
echo definition_list($indices, '.dm_little_dl');
 public function getLanguageForSelect()
 {
     return array($this->getLanguage() => format_language($this->getLanguage()));
 }
Example #26
0
<?php

$localizations = $sf_simple_cms_page->getLocalizations(ESC_RAW);
foreach ($localizations as $localization) {
    ?>
  <?php 
    echo link_to(format_language(substr($localization, 0, 2)), sfSimpleCMSTools::urlForPage($sf_simple_cms_page->getSlug(), 'edit=true', $localization));
}
 public function execute($request)
 {
     $this->form = new sfForm();
     $this->culture = $this->context->user->getCulture();
     $this->globalForm = new SettingsGlobalForm();
     $this->siteInformationForm = new SettingsSiteInformationForm();
     $this->defaultTemplateForm = new SettingsDefaultTemplateForm();
     $this->uiLabelForm = new SettingsGenericForm(array(), array('settings' => QubitSetting::getByScope('ui_label'), 'scope' => 'ui_label', 'fieldsRequired' => false));
     $this->oaiRepositoryForm = new SettingsOaiRepositoryForm();
     $this->initializeDefaultPageElementsForm();
     // Handle POST data (form submit)
     if ($request->isMethod('post')) {
         // Clean cache
         $cache = new sfFileCache(array('cache_dir' => sfConfig::get('sf_app_cache_dir') . '/settings'));
         $cache->clean();
         // Global settings form submission
         if (null !== $request->global_settings) {
             // Hack to populate "version" field so it displays
             // if validation fails. By default, their values are not included in
             // $request->parameterHolder (and thus are not bound) because their
             // <input> field is disabled.
             $version = null !== ($setting = QubitSetting::getSettingByName('version')) ? $setting->getValue(array('sourceCulture' => true)) : null;
             $this->globalForm->bind(array_merge($request->global_settings, array('version' => $version)));
             if ($this->globalForm->isValid()) {
                 // Do update and redirect to avoid repeat submit wackiness
                 $this->updateGlobalSettings();
                 $this->redirect('settings/list');
             }
         }
         // Handle site information form submission
         if (null !== $request->site_information) {
             $this->siteInformationForm->bind($request->site_information);
             if ($this->siteInformationForm->isValid()) {
                 // Do update and redirect to avoid repeat submit wackiness
                 $this->updateSiteInformationSettings();
                 $this->redirect('settings/list');
             }
         }
         // Handle default template form submission
         if (null !== $request->default_template) {
             $this->defaultTemplateForm->bind($request->default_template);
             if ($this->defaultTemplateForm->isValid()) {
                 // Do update and redirect to avoid repeat submit wackiness
                 $this->updateDefaultTemplateSettings($this->defaultTemplateForm);
                 $this->redirect('settings/list');
             }
         }
         // Handle default template form submission
         if (null !== $request->ui_label) {
             $this->uiLabelForm->bind($request->ui_label);
             if ($this->uiLabelForm->isValid()) {
                 // Do update and redirect to avoid repeat submit wackiness
                 $this->updateUiLabelSettings($this->uiLabelForm);
                 $this->redirect('settings/list');
             }
         }
         // Handle OAI Repository form submission
         if (null !== $request->oai_repository) {
             $this->oaiRepositoryForm->bind($request->oai_repository);
             if ($this->oaiRepositoryForm->isValid()) {
                 // Do update and redirect to avoid repeat submit wackiness
                 $this->updateOaiRepositorySettings($this->oaiRepositoryForm);
                 $this->redirect('settings/list');
             }
         }
         if (null !== ($languageCode = $request->languageCode)) {
             try {
                 format_language($languageCode, $languageCode);
             } catch (Exception $e) {
                 $this->redirect(array('module' => 'settings', 'action' => 'list'));
             }
             $setting = new QubitSetting();
             $setting->name = $languageCode;
             $setting->scope = 'i18n_languages';
             $setting->value = $languageCode;
             $setting->deleteable = true;
             $setting->editable = true;
             $setting->getCurrentSettingI18n()->setCulture('en');
             $setting->sourceCulture = 'en';
             $setting->save();
         }
     }
     // Populate forms
     $this->populateGlobalForm();
     $this->populateSiteInformationForm();
     $this->populateDefaultTemplateForm($this->defaultTemplateForm);
     $this->populateUiLabelForm($this->uiLabelForm);
     $this->populateOaiRepositoryForm($this->oaiRepositoryForm);
     // Last symfony 1.0 forms holdout
     $this->i18nLanguages = QubitSetting::getByScope('i18n_languages');
     $this->form->setValidator('languageCode', new sfValidatorI18nChoiceLanguage());
     $this->form->setWidget('languageCode', new sfWidgetFormI18nChoiceLanguage(array('add_empty' => true, 'culture' => $this->context->user->getCulture())));
     // make vars available to template
     $this->availableLanguages = self::$availableLanguges;
 }
 public function loadEditor(sfEvent $event)
 {
     $user = sfContext::getInstance()->getUser();
     $this->configuration->loadHelpers(array('Asset', 'Partial', 'I18N'));
     $menu = $event->getSubject();
     $content = $event['content'];
     $menuItem = $event['menuItem'];
     $sympalConfiguration = sfSympalConfiguration::getActive();
     $user = sfContext::getInstance()->getUser();
     $request = sfContext::getInstance()->getRequest();
     $contentEditor = $menu->getChild($content->getType()->getLabel() . ' Actions');
     if ($sympalConfiguration->isAdminModule()) {
         $contentEditor->addChild(image_tag('/sf/sf_admin/images/list.png') . ' ' . __('View ' . $content->getType()->getLabel()), $content->getRoute());
     }
     $contentEditor->addChild(image_tag('/sf/sf_admin/images/add.png') . ' ' . __('Create New ' . $content->getType()->getLabel()), '@sympal_content_create_type?type=' . $content['Type']['slug'])->setCredentials('ManageContent');
     $contentEditor->addChild(image_tag('/sf/sf_admin/images/edit.png') . ' ' . __('Edit ' . $content->getType()->getLabel()), $content->getEditRoute())->setCredentials('ManageContent');
     $contentEditor->addChild(image_tag('/sf/sf_admin/images/edit.png') . ' ' . __('Edit Content Type'), '@sympal_content_types_edit?id=' . $content->getType()->getId())->setCredentials('ManageMenus');
     if ($menuItem && $menuItem->exists()) {
         $contentEditor->addChild(image_tag('/sf/sf_admin/images/edit.png') . ' ' . __('Edit Menu Item'), '@sympal_content_menu_item?id=' . $content->getId())->setCredentials('ManageMenus');
     } else {
         $contentEditor->addChild(image_tag('/sf/sf_admin/images/add.png') . ' ' . __('Add to Menu'), '@sympal_content_menu_item?id=' . $content->getId())->setCredentials('ManageMenus');
     }
     if (sfSympalConfig::isI18nEnabled()) {
         foreach (sfSympalConfig::getLanguageCodes() as $code) {
             if (sfContext::getInstance()->getUser()->getEditCulture() != $code) {
                 $contentEditor->addChild(image_tag('/sfSympalPlugin/images/flags/' . strtolower($code) . '.png') . ' Edit ' . format_language($code), '@sympal_change_edit_language?language=' . $code, 'title=Switch to ' . format_language($code));
             }
         }
     }
 }
  <?php 
echo render_show(__('Dates of creation revision deletion'), render_value($resource->getRevisionHistory(array('cultureFallback' => true))));
?>

  <div class="field">
    <h3><?php 
echo __('Language(s)');
?>
</h3>
    <div>
      <ul>
        <?php 
foreach ($resource->languageOfDescription as $code) {
    ?>
          <li><?php 
    echo format_language($code);
    ?>
</li>
        <?php 
}
?>
      </ul>
    </div>
  </div>

  <div class="field">
    <h3><?php 
echo __('Script(s)');
?>
</h3>
    <div>
Example #30
0
<?php

echo format_language($concept->getLanguage());
echo object_input_hidden_tag($concept, 'getLanguage', array('name' => "concept[language]", 'id' => "concept_language"));