function get_AG($template, $errorMessages)
{
    $accessGroupM = new RowManager_AccessGroupManager();
    $multilingualLabelL = new RowManager_MultilingualLabelManager();
    $join = new JoinPair($multilingualLabelL->getJoinOnFieldX('label_key'), $accessGroupM->getJoinOnFieldX('accessgroup_key'));
    $MTM = new MultiTableManager();
    $MTM->addRowManager($multilingualLabelL);
    $MTM->addRowManager($accessGroupM, $join);
    $MTM->constructSearchCondition('language_id', '=', '1', true);
    $result = $MTM->find();
    if (!isset($result)) {
        $errorMessages = 'Failed to join database to get label';
    } else {
        $result->setFirst();
        $count = 0;
        while ($resultMLM = $result->getNext($multilingualLabelL)) {
            $resultAGM = $result->getCurrent($accessGroupM);
            $agLabel[] = $resultMLM->getLabel();
            $agID[] = $resultAGM->getID();
        }
        $template->set('agLabel', $agLabel);
        $template->set('agID', $agID);
    }
    return $errorMessages;
}
Esempio n. 2
0
 function loadTemplateFromKey($templateKey, $appID, $languageID)
 {
     if ($this->manager->loadByKey($templateKey)) {
         $labelKey = $this->manager->getLabelKey();
         //$this->setAppID($appID);
         $labelManager = new RowManager_MultilingualLabelManager();
         $labelManager->loadByKeyInfo("", $labelKey, $languageID);
         return $labelManager->getLabel();
     }
 }
Esempio n. 3
0
 /**
  * function __construct
  * <pre>
  * Initialize the Class ...
  * </pre>
  * @param $pageID [INTEGER] The ID of the Page we are getting labels for
  * @param $key [STRING]  The label key we are searching for
  * @param $languageID [INTEGER] the ID of the language of labels we are requesting
  * @param $sortBy [STRING] the field name to sort list by
  * @return [void]
  */
 function __construct($pageID = '', $key = '', $languageID = '', $sortBy = '')
 {
     $searchManager = new RowManager_MultilingualLabelManager();
     // NOTE: if you need to narrow the field of the search then uncommnet
     // the following and set the proper search criteria.
     $searchManager->setValueByFieldName('page_id', $pageID);
     $searchManager->setValueByFieldName('label_key', $key);
     $searchManager->setValueByFieldName('language_id', $languageID);
     $searchManager->setSortOrder($sortBy);
     $this->resultSet = $searchManager->find();
 }
 /**
  * function getLabelManager
  * <pre>
  * returns a label manager object
  * </pre>
  * <pre><code>
  * if language ID is not provided, then use class default.
  * if desired [KEY] exists then
  *     if desired [LANGUAGEID] exists 
  *         return label
  *     else
  *         return label in 1st avaialble language
  *     end if
  * else
  *     return key
  * end if
  * </code></pre>
  * @param $key [STRING] The Key of the label we should return
  * @param $languageID [INTEGER] The Language ID of the label to return
  * @return [OBJECT] RowManager_MultilingualLabelManager
  */
 function getLabelManager($key, $languageID = '')
 {
     $labelManager = new RowManager_MultilingualLabelManager();
     // if language ID is not provided, then use class default.
     if ($languageID == '') {
         $languageID = $this->languageID;
     }
     // if desired [KEY] exists then
     if (array_key_exists($key, $this->labels)) {
         // if desired [LANGUAGEID] exists
         if (array_key_exists($languageID, $this->labels[$key])) {
             // return label in requested Language ID
             $pageID = $this->pageManager->getID();
             $successful = $labelManager->loadByKeyInfo($pageID, $key, $languageID);
             // echo 'successful['.$successful.']<br/>';
             // echo 'lableManager<pre>'.print_r($labelManager,true).'</pre>';
         } else {
             // else
             // return label in 1st avaialble language
             $labelData = $this->labels[$key];
             $languagesIDAvailable = array_keys($labelData);
             $languageID = $languagesIDAvailable[0];
             $pageID = $this->pageManager->getID();
             $labelManager->loadByKeyInfo($pageID, $key, $languageID);
         }
         // end if
     } else {
         // Make sure the pageID is set
         $labelManager->setPageID($this->pageManager->getID());
     }
     // end if
     $labelManager->setLanguageID($languageID);
     return $labelManager;
 }
Esempio n. 5
0
$tableDefHTMLBlock = new HTMLBlock(null, '');
$tableDefHTMLBlock->dropTable($db);
$tableDefHTMLBlock->createTable($db);
/*
 * XMLObject_MultilingualManager
 *
 * The SQL definition of the Multilingual Tables.
 */
//Create Tables
$tableSM = new RowManager_MultilingualSeriesManager();
$tableSM->dropTable();
$tableSM->createTable();
$tablePM = new RowManager_MultilingualPageManager();
$tablePM->dropTable();
$tablePM->createTable();
$tableLM = new RowManager_MultilingualLabelManager();
$tableLM->dropTable();
$tableLM->createTable();
$tableXL = new RowManager_XLationManager();
$tableXL->dropTable();
$tableXL->createTable();
$dir = $extension . SITE_PATH_MODULES;
$files1 = scandir($dir);
//echo "----------<br><pre>";
//print_r ($files1);
//echo"</pre><br>--------<br><br>";
//echo "Directory of <b>$dir</b><br>";
//echo "---------------------------<br>";
for ($i = 0; $i < count($files1); $i++) {
    if ($files1[$i] !== "." && $files1[$i] !== ".." && is_dir($dir . $files1[$i])) {
        if (substr($files1[$i], 0, 5) == "site_") {
Esempio n. 6
0
 /**
  * function deleteEntry
  * <pre>
  * Updates the DB table info.
  * </pre>
  * @return [void]
  */
 function deleteEntry()
 {
     parent::deleteEntry();
     // now make sure that other language versions linked to this entry
     // are also removed ...
     // make a new labelManager since current one had had it's fields limited
     // and we need to have the id fields for the load operation ...
     $labelManager = new RowManager_MultilingualLabelManager();
     $key = $this->labelManager->getKey();
     $pageID = $this->labelManager->getPageID();
     while ($labelManager->loadByKeyInfo($pageID, $key)) {
         $labelManager->deleteEntry();
     }
 }
Esempio n. 7
0
 /**
  * function updateDBTable
  * <pre>
  * Updates the DB table info.
  * </pre>
  * @return [void]
  */
 function updateDBTable()
 {
     // make sure label is translated into UnicodeEntities
     $data = $this->getLabel();
     $newData = Unicode_utf8ToUnicodeEntities($data);
     $this->setLabel($newData);
     parent::updateDBTable();
     // Go Through and remove any existing xlation requests for this
     // label entry.
     $currentPageID = $this->getPageID();
     $currentKey = $this->getKey();
     $currentLanguageID = $this->getLanguageID();
     $xlationManager = new RowManager_XLationManager();
     // for each label with matching PageID & Key
     $labelManager = new RowManager_MultilingualLabelManager();
     $labelManager->setPageID($currentPageID);
     $labelManager->setKey($currentKey);
     $labelList = $labelManager->getListIterator();
     $labelList->setFirst();
     while ($label = $labelList->getNext()) {
         // delete any xlation entry with current language_id &
         // matching label_id
         if ($xlationManager->loadByLabelAndLanguage($label->getID(), $currentLanguageID)) {
             $xlationManager->deleteEntry();
         }
     }
     // next label
 }