/** * function addLabel * <pre> * Creates a new label in the Labels DB table. * </pre> * @param $key [STRING] name of the label key * @param $text [STRING] name of the label text * @param $languageKey [STRING] the language KEY of the language the text is in * @return [void] */ function addLabel($key, $text, $languageKey, $update = false) { // if we haven't loaded the language list then load it now. if (is_null($this->languageList)) { $this->languageList = new LanguageList(); } // if a page context is properly set then if ($this->pageManager->isLoaded()) { // get the language ID from the given language Key $languageID = $this->languageList->getLanguageIDByKey($languageKey); $pageID = $this->pageManager->getID(); // create the new label $label = new RowManager_MultilingualLabelManager(); // if label is unique then if ($label->isUnique($pageID, $key, $languageID)) { $label->setPageID($pageID); $label->setKey($key); $label->setLabel($text); $label->setLanguageID($languageID); $label->createNewEntry(); } else { // the label is not unique - an entry already exists in the DB // NEW CODE BY Russ Martin // TODO - Add code here to make the tools setup the final authority // echo 'The key ' . $key . ' is not unique <br/>'; /* $label->setPageID( $pageID ); $label->setKey( $key ); $label->setLabel( $text ); $label->setLanguageID( $languageID ); $label->updateDBTable(); // <-- primary code: used to update table if some aspect of data is not unique */ } } else { die('MultilingualManager::addLabel() : attempting to add label without a pageManager loaded!'); } }