当前位置: 首页>>代码示例>>PHP>>正文


PHP Translation::getPhraseId方法代码示例

本文整理汇总了PHP中Translation::getPhraseId方法的典型用法代码示例。如果您正苦于以下问题:PHP Translation::getPhraseId方法的具体用法?PHP Translation::getPhraseId怎么用?PHP Translation::getPhraseId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Translation的用法示例。


在下文中一共展示了Translation::getPhraseId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setName

 /**
  * Set the type name for the given language.  A new entry in
  * the database will be created if the language did not exist.
  *
  * @param int $p_languageId
  * @param string $p_value
  *
  * @return boolean
  */
 public function setName($p_languageId, $p_value)
 {
     global $g_ado_db;
     if (!is_numeric($p_languageId)) {
         return false;
     }
     // if the string is empty, nuke it
     if (!is_string($p_value) || $p_value == '') {
         if ($phrase_id = $this->translationExists($p_languageId)) {
             $trans = new Translation($p_languageId, $phrase_id);
             $trans->delete();
             $changed = true;
         } else {
             $changed = false;
         }
     } else {
         $description = new Translation($p_languageId, $this->getProperty('fk_phrase_id'));
         if ($description->exists()) {
             $changed = $description->setText($p_value);
         } else {
             $changed = $description->create($p_value);
             if ($changed && is_null($this->getProperty('fk_phrase_id'))) {
                 $this->setProperty('fk_phrase_id', $description->getPhraseId());
             }
         }
     }
     return $changed;
 }
开发者ID:nidzix,项目名称:Newscoop,代码行数:37,代码来源:ArticleTypeField.php

示例2: setName

	/**
	 * Set the type name for the given language.  A new entry in
	 * the database will be created if the language did not exist.
	 *
	 * @param int $p_languageId
	 * @param string $p_value
	 *
	 * @return boolean
	 */
	public function setName($p_languageId, $p_value)
	{
		global $g_ado_db;
		if (!is_numeric($p_languageId)) {
			return false;
		}
		// if the string is empty, nuke it
		if (!is_string($p_value) || $p_value == '') {
			if ($phrase_id = $this->translationExists($p_languageId)) {
			    $trans = new Translation($p_languageId, $phrase_id);
			    $trans->delete();
				$changed = true;
			} else {
			    $changed = false;
			}
		} else {
			$description = new Translation($p_languageId, $this->getProperty('fk_phrase_id'));
			if ($description->exists()) {
                $changed = $description->setText($p_value);
			} else {
				$changed = $description->create($p_value);
				if ($changed && is_null($this->getProperty('fk_phrase_id'))) {
					$this->setProperty('fk_phrase_id', $description->getPhraseId());
				}
			}
		}

		if ($changed) {
			if (function_exists("camp_load_translation_strings")) {
			    camp_load_translation_strings("api");
			}
			$logtext = getGS('Field "$1" updated', $this->m_data['field_name']);
			Log::Message($logtext, null, 143);
		}

		return $changed;
	} // fn setName
开发者ID:nistormihai,项目名称:Newscoop,代码行数:46,代码来源:ArticleTypeField.php

示例3: DebateAnswer

            // UPLOAD_ERR_CANT_WRITE
            camp_html_display_error(getGS("There was a problem uploading the file."), null, true);
            break;
    }
} else {
    camp_html_display_error(getGS("The file exceeds the allowed max file size."), null, true);
}
$DebateAnswer = new DebateAnswer($f_fk_language_id, $f_debate_nr, $f_debateanswer_nr);
if (!$DebateAnswer->exists()) {
    camp_html_display_error(getGS("Debate Answer \$1 does not exist.", $f_debateanswer_nr), null, true);
    exit;
}
$description = new Translation(@$f_language_id);
$description->create($f_description);
$attributes = array();
$attributes['fk_description_id'] = $description->getPhraseId();
$attributes['fk_user_id'] = $g_user->getUserId();
if ($f_language_specific == "yes") {
    $attributes['fk_language_id'] = @$f_language_id;
}
if ($f_content_disposition == "attachment") {
    $attributes['content_disposition'] = "attachment";
}
if (!empty($_FILES['f_file'])) {
    $file = Attachment::OnFileUpload($_FILES['f_file'], $attributes);
} else {
    camp_html_goto_page(camp_html_article_url($articleObj, @$f_language_id, 'files/popup.php'));
}
// Check if image was added successfully
if (PEAR::isError($file)) {
    camp_html_add_msg($file->getMessage());
开发者ID:nidzix,项目名称:Newscoop,代码行数:31,代码来源:do_add.php

示例4: translationExists

 /**
  * A quick lookup to see if the current language was already translated
  * for this article type: used by delete and update in setName.
  * Returns 0 if no translation or the phrase_id if there is one.
  *
  * @param int p_languageId
  *
  * @return 0 or phrase_id
  **/
 public function translationExists($p_languageId)
 {
     if ($this->m_metadata->getPhraseId() != -1) {
         $translation = new Translation($p_languageId, $this->m_metadata->getPhraseId());
         if ($translation->exists()) {
             return $translation->getPhraseId();
         }
     }
     return 0;
 }
开发者ID:nidzix,项目名称:Newscoop,代码行数:19,代码来源:ArticleType.php

示例5: Translation

require_once($GLOBALS['g_campsiteDir'].'/classes/ArticleAttachment.php');
require_once($GLOBALS['g_campsiteDir'].'/classes/Translation.php');

if (!SecurityToken::isValid()) {
    camp_html_display_error(getGS('Invalid security token!'));
    exit;
}
$f_language_id = Input::Get('f_language_id', 'int', 0);
$f_language_selected = Input::Get('f_language_selected', 'int', 0);

foreach ($_POST['file'] as $id => $values) {
    $description = new Translation((int) $f_language_selected);
    $description->create($values['f_description']); //$values

    $updateArray = array();
    $updateArray['fk_description_id'] = $description->getPhraseId();
/*    if ($values['f_language_specific'] == "yes") {
        $updateArray['fk_language_id'] = $f_language_selected;
    }
*/
    if ($values['f_content_disposition'] == "attachment") {
        $updateArray['content_disposition'] = "attachment";
    }
    $fileObj = new Attachment((int) $id);
    $fileObj->update($updateArray);
}

camp_html_add_msg(getGS("Images updated."), "ok");
camp_html_goto_page("/$ADMIN/media-archive/index.php#files");
?>
开发者ID:nistormihai,项目名称:Newscoop,代码行数:30,代码来源:do_multiedit_file.php


注:本文中的Translation::getPhraseId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。