本文整理汇总了PHP中Section::getUrlName方法的典型用法代码示例。如果您正苦于以下问题:PHP Section::getUrlName方法的具体用法?PHP Section::getUrlName怎么用?PHP Section::getUrlName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Section
的用法示例。
在下文中一共展示了Section::getUrlName方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetURI
public static function GetURI($p_publicationId, $p_languageId, $p_issueNo = null, $p_sectionNo = null, $p_articleNo = null)
{
$translator = \Zend_Registry::get('container')->getService('translator');
$languageObj = new Language($p_languageId);
if (!$languageObj->exists()) {
return new PEAR_Error($translator->trans('Language does not exist.'));
}
$uri = '/' . $languageObj->getCode() . '/';
if (!is_null($p_issueNo) && is_null($p_articleNo)) {
$issueObj = new Issue($p_publicationId, $p_languageId, $p_issueNo);
if (!$issueObj->exists()) {
return new PEAR_Error($translator->trans('Issue does not exist.'));
}
$uri .= $issueObj->getUrlName() . '/';
}
if (!is_null($p_sectionNo) && is_null($p_articleNo)) {
$sectionObj = new Section($p_publicationId, $p_issueNo, $p_languageId, $p_sectionNo);
if (!$sectionObj->exists()) {
return new PEAR_Error($translator->trans('Section does not exist.'));
}
$uri .= $sectionObj->getUrlName() . '/';
}
if (!is_null($p_articleNo)) {
$articleObj = new Article($p_languageId, $p_articleNo);
if (!$articleObj->exists()) {
return new PEAR_Error($translator->trans('Article does not exist.'));
}
$issueObj = new Issue($p_publicationId, $p_languageId, $articleObj->getIssueNumber());
$sectionObj = new Section($p_publicationId, $articleObj->getIssueNumber(), $p_languageId, $articleObj->getSectionNumber());
$uri .= $issueObj->getUrlName() . '/';
$uri .= $sectionObj->getUrlName() . '/';
$uri .= $articleObj->getUrlName() . '/';
}
return $uri;
}
示例2: GetURI
public static function GetURI($p_publicationId, $p_languageId, $p_issueNo = null, $p_sectionNo = null, $p_articleNo = null)
{
$languageObj = new Language($p_languageId);
if (!$languageObj->exists()) {
return new PEAR_Error(getGS('Language does not exist.'));
}
$uri = $GLOBALS['Campsite']['SUBDIR'] . '/' . $languageObj->getCode() . '/';
if (!is_null($p_issueNo) && is_null($p_articleNo)) {
$issueObj = new Issue($p_publicationId, $p_languageId, $p_issueNo);
if (!$issueObj->exists()) {
return new PEAR_Error(getGS('Issue does not exist.'));
}
$uri .= $issueObj->getUrlName() . '/';
}
if (!is_null($p_sectionNo) && is_null($p_articleNo)) {
$sectionObj = new Section($p_publicationId, $p_issueNo, $p_languageId, $p_sectionNo);
if (!$sectionObj->exists()) {
return new PEAR_Error(getGS('Section does not exist.'));
}
$uri .= $sectionObj->getUrlName() . '/';
}
if (!is_null($p_articleNo)) {
$articleObj = new Article($p_languageId, $p_articleNo);
if (!$articleObj->exists()) {
return new PEAR_Error(getGS('Article does not exist.'));
}
$issueObj = new Issue($p_publicationId, $p_languageId, $articleObj->getIssueNumber());
$sectionObj = new Section($p_publicationId, $articleObj->getIssueNumber(), $p_languageId, $articleObj->getSectionNumber());
$uri .= $issueObj->getUrlName() . '/';
$uri .= $sectionObj->getUrlName() . '/';
$uri .= $articleObj->getUrlName() . '/';
}
return $uri;
}
示例3: Section
camp_html_display_error(getGS('No such section.'), $backLink);
exit;
}
$translationSectionObj = new Section($f_publication_id, $f_issue_number, $f_translation_language, $f_section_number);
if (!$translationSectionObj->exists()) {
if (!$g_user->hasPermission("ManageSection")) {
camp_html_add_msg(getGS('A section must be created for the selected language but you do not have the right to create a section.'));
camp_html_goto_page($backLink);
}
foreach ($sectionObj->getData() as $field => $fieldValue) {
if ($field != 'IdLanguage') {
$translationSectionObj->setProperty($field, $fieldValue, false);
}
}
$f_section_name = Input::Get('f_section_name', 'string', $sectionObj->getName());
$f_section_urlname = Input::Get('f_section_urlname', 'string', $sectionObj->getUrlName());
if ($f_section_urlname == "") {
camp_html_add_msg(getGS('You must fill in the $1 field.', '"' . getGS('New section URL name') . '"'));
camp_html_goto_page($backLink);
}
if (!camp_is_valid_url_name($f_section_urlname)) {
camp_html_add_msg(getGS('The $1 field may only contain letters, digits and underscore (_) character.', '"' . getGS('New section URL name') . '"'));
camp_html_goto_page($backLink);
}
$translationSectionObj->create($f_section_name, $f_section_urlname);
if (!$translationSectionObj->exists()) {
camp_html_add_msg(getGS('Unable to create the section for translation $1.', $translationLanguageObj->getName()));
camp_html_goto_page($backLink);
}
} else {
$f_section_name = Input::Get('f_section_name', 'string', $sectionObj->getName());
示例4: getGS
if (!$g_user->hasPermission("TranslateArticle")) {
$errorStr = getGS('You do not have the right to translate articles.');
camp_html_display_error($errorStr, $BackLink);
exit;
}
// When the user selects a language the form is submitted to the same page (translation.php).
// Read article translation form input values for the case when the page has been reloaded
// because of language select.
$f_translation_title = Input::Get('f_translation_title', 'string', '', true);
$f_language_selected = Input::Get('f_translation_language', 'int', 0, true);
$f_translation_language = Input::Get('f_translation_language', 'int', 0, true);
if ($f_publication_id > 0) {
$f_translation_issue_name = Input::Get('f_issue_name', 'string', $issueObj->getName(), true);
$f_translation_issue_urlname = Input::Get('f_issue_urlname', 'string', $issueObj->getUrlName(), true);
$f_translation_section_name = Input::Get('f_section_name', 'string', $sectionObj->getName(), true);
$f_translation_section_urlname = Input::Get('f_section_urlname', 'string', $sectionObj->getUrlName(), true);
}
$allLanguages = Language::GetLanguages(null, null, null, array(), array(array('field' => 'byname', 'dir' => 'asc')), true);
$articleLanguages = $articleObj->getLanguages();
$articleLanguages = DbObjectArray::GetColumn($articleLanguages, "Id");
if ($f_language_selected > 0 && $f_issue_number > 0) {
$translationIssueObj = new Issue($f_publication_id, $f_language_selected, $f_issue_number);
$translationSectionObj = new Section($f_publication_id, $f_issue_number, $f_language_selected, $f_section_number);
}
if ($f_publication_id > 0) {
$topArray = array('Pub' => $publicationObj, 'Issue' => $issueObj, 'Section' => $sectionObj, 'Article' => $articleObj);
camp_html_content_top(getGS('Translate article'), $topArray, true, true);
} else {
$crumbs = array();
$crumbs[] = array(getGS("Actions"), "");
$crumbs[] = array(getGS('Translate article'), "");
示例5: underscore
:</td>
<td>
<input type="text" class="input_text" name="cName" size="32" value="<?php
p(htmlspecialchars($sectionObj->getName()));
?>
" />
</td>
</tr>
<tr>
<td align="right"><?php
putGS("URL Name");
?>
:</td>
<td>
<input type="text" class="input_text" name="cShortName" size="32" value="<?php
p(htmlspecialchars($sectionObj->getUrlName()));
?>
" alt="alnum|1|A|true|false|_" emsg="<?php
putGS('The $1 field may only contain letters, digits and underscore (_) character.', "'" . getGS('URL Name') . "'");
?>
"/>
</td>
</tr>
<?php
if (SaaS::singleton()->hasPermission('ManageSectionSubscriptions')) {
?>
<tr>
<td align="right"><?php
putGS("Subscriptions");
?>
:</td>
示例6: putGS
<tr>
<td align="right"><?php putGS("Number"); ?>:</td>
<td>
<?php p($sectionObj->getSectionNumber()); ?>
</td>
</tr>
<tr>
<td align="right"><?php putGS("Name"); ?>:</td>
<td>
<input type="text" class="input_text" name="cName" size="32" value="<?php p(htmlspecialchars($sectionObj->getName())); ?>" />
</td>
</tr>
<tr>
<td align="right"><?php putGS("URL Name"); ?>:</td>
<td>
<input type="text" class="input_text" name="cShortName" size="32" value="<?php p(htmlspecialchars($sectionObj->getUrlName())); ?>" />
</td>
</tr>
<tr>
<td align="right"><?php putGS("Subscriptions"); ?>:</td>
<td>
<select name="cSubs" class="input_select">
<option value="n"> --- </option>
<option value="a"><?php putGS("Add section to all subscriptions."); ?></option>
<option value="d"><?php putGS("Delete section from all subscriptions."); ?></option>
</select>
</td>
</tr>
<tr>
<td align="right" valign="top"><?php putGS("Description"); ?>:</td>
<td>
示例7: array
$f_section_name = Input::Get('f_section_name', 'string', $sectionObj->getName());
$f_section_urlname = Input::Get('f_section_urlname', 'string', $sectionObj->getUrlName());
if ($f_section_urlname == "") {
camp_html_add_msg($translator->trans('You must fill in the $1 field.', array('$1' => '"' . $translator->trans('New section URL name', array(), 'articles') . '"')));
camp_html_goto_page($backLink);
}
if (!camp_is_valid_url_name($f_section_urlname)) {
camp_html_add_msg($translator->trans('The $1 field may only contain letters, digits and underscore (_) character.', array('$1' => '"' . $translator->trans('New section URL name', array(), 'articles') . '"')));
camp_html_goto_page($backLink);
}
$translationSectionObj->create($f_section_name, $f_section_urlname);
if (!$translationSectionObj->exists()) {
camp_html_add_msg($translator->trans('Unable to create the section for translation $1.', array('$1' => $translationLanguageObj->getName()), 'articles'));
camp_html_goto_page($backLink);
}
} else {
$f_section_name = Input::Get('f_section_name', 'string', $translationSectionObj->getName());
$f_section_urlname = Input::Get('f_section_urlname', 'string', $translationSectionObj->getUrlName());
$translationSectionObj->update(array('Name' => $f_section_name, 'ShortName' => $f_section_urlname));
}
}
if ($articleObj->translationTitleExists($f_translation_title, $f_translation_language)) {
camp_html_add_msg($translator->trans("There already is an article with the same name. Please change the name and try again.", array(), 'articles'), "ok");
camp_html_goto_page($backLink);
exit;
}
$articleCopy = $articleObj->createTranslation($f_translation_language, $g_user->getUserId(), $f_translation_title);
\Zend_Registry::get('container')->getService('dispatcher')->dispatch('article.translate', new \Newscoop\EventDispatcher\Events\GenericEvent($this, array('article' => $articleCopy)));
camp_html_add_msg($translator->trans("Article translation created.", array(), 'articles'), "ok");
ArticleIndex::RunIndexer(3, 10, true);
camp_html_goto_page(camp_html_article_url($articleCopy, $f_translation_language, 'edit.php'), true);