GetColumn() public static method

Given an array of DatabaseObjects, return one column of the data.
public static GetColumn ( array $p_array, string $p_columnName ) : array
$p_array array
$p_columnName string
return array
Ejemplo n.º 1
0
        $f_destination_section_number = $tmpSection->getSectionNumber();
    } else {
        $tmpSection = new Section($f_destination_publication_id, $f_destination_issue_number, $firstArticle->getLanguageId(), $f_destination_section_number);
        if (!$tmpSection->exists()) {
            $f_destination_section_number = 0;
        }
    }
}
// Special case:
// You cannot copy the articles if there is no cooresponding translated issue/section
// in the destination issue.  For example, you cannot copy a french article to an
// issue that has ONLY an english translation.
$issueLanguages = array();
if ($f_destination_issue_number > 0) {
    $issueTranslations = Issue::GetIssues($f_destination_publication_id, null, $f_destination_issue_number, null, null, false, null, true);
    $issueLanguages = DbObjectArray::GetColumn($issueTranslations, "IdLanguage");
}
// $actionDenied is TRUE if any articles cannot be moved/duped.
$actionDenied = false;
foreach ($articles as $articleNumber => $languageArray) {
    foreach ($languageArray as $languageId => $article) {
        $tmpActionDenied = count($issueLanguages) > 0 && !in_array($languageId, $issueLanguages);
        $actionDenied |= $tmpActionDenied;
        // Uncheck any articles that cannot be moved/duped.
        if ($tmpActionDenied) {
            unset($doAction[$articleNumber][$languageId]);
            if (isset($doAction[$articleNumber]) && count($doAction[$articleNumber]) == 0) {
                unset($doAction[$articleNumber]);
            }
        }
    }
Ejemplo n.º 2
0
// Only for the article screens.
$publicationObj = null;
$issueObj = null;
$sectionObj = null;
if ($f_publication_id > 0) {
    $publicationObj = new Publication($f_publication_id);
    if ($f_issue_number > 0 && $f_article_language > 0) {
        $issueObj = new Issue($f_publication_id, $f_article_language, $f_issue_number);
        if ($f_section_number > 0) {
            $sectionObj = new Section($f_publication_id, $f_issue_number, $f_article_language, $f_section_number);
        }
    }
}
// Only show the languages for sections which have been translated.
$sections = Section::GetSections($f_publication_id, $f_issue_number, null, null, null, null, true);
$languageIds = DbObjectArray::GetColumn($sections, 'IdLanguage');
$allLanguages = array();
foreach ($languageIds as $languageId) {
    if (!isset($allLanguages[$languageId])) {
        $allLanguages[$languageId] = new Language($languageId);
    }
}
$allArticleTypes = ArticleType::GetArticleTypes();
$topArray = array('Pub' => $publicationObj, 'Issue' => $issueObj, 'Section' => $sectionObj);
camp_html_content_top(getGS('Add new article'), $topArray, true, false, array(getGS("Articles") => "/{$ADMIN}/articles/?f_publication_id={$f_publication_id}&f_issue_number={$f_issue_number}&f_section_number={$f_section_number}&f_language_id={$f_language_id}"));
?>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="1" class="action_buttons" style="padding-top: 5px;">
<TR>
	<TD><A HREF="<?php 
echo "/{$ADMIN}/articles/?f_publication_id={$f_publication_id}&f_issue_number={$f_issue_number}&f_section_number={$f_section_number}&f_language_id={$f_language_id}";
?>
Ejemplo n.º 3
0
}
// 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'), "");
    echo camp_html_breadcrumbs($crumbs);
}
?>
<table cellpadding="1" cellspacing="0" class="action_buttons" style="padding-top: 10px;">
Ejemplo n.º 4
0
if (!in_array($f_language_selected, DbObjectArray::GetColumn($allArticleLanguages, 'Id'))) {
    $f_language_selected = 0;
}
$sqlOptions = array("LIMIT" => array("START" => $f_article_offset, "MAX_ROWS" => $ArticlesPerPage));
if ($f_language_selected) {
    // Only show a specific language.
    $totalArticles = Article::GetArticles($f_publication_id, $f_issue_number, $f_section_number, $f_language_selected, null, true);
    $allArticles = Article::GetArticles($f_publication_id, $f_issue_number, $f_section_number, $f_language_selected, $sqlOptions);
    $numUniqueArticles = $totalArticles;
    $numUniqueArticlesDisplayed = count($allArticles);
} else {
    // Show articles in all languages.
    $totalArticles = Article::GetArticles($f_publication_id, $f_issue_number, $f_section_number, null, null, true);
    $allArticles = Article::GetArticlesGrouped($f_publication_id, $f_issue_number, $f_section_number, null, $f_language_id, $sqlOptions);
    $numUniqueArticles = Article::GetArticlesGrouped($f_publication_id, $f_issue_number, $f_section_number, null, null, null, true);
    $numUniqueArticlesDisplayed = count(array_unique(DbObjectArray::GetColumn($allArticles, 'Number')));
}
$numArticlesThisPage = count($allArticles);
$previousArticleNumber = 0;
$pagerUrl = "index.php?f_publication_id=" . $f_publication_id . "&f_issue_number=" . $f_issue_number . "&f_section_number=" . $f_section_number . "&f_language_id=" . $f_language_id . "&f_language_selected=" . $f_language_selected . "&";
$pager = new SimplePager($numUniqueArticles, $ArticlesPerPage, $offsetVarName, $pagerUrl);
$topArray = array('Pub' => $publicationObj, 'Issue' => $issueObj, 'Section' => $sectionObj);
camp_html_content_top(getGS('Article List') . ': ' . $this->view->escape($sectionObj->getName()), $topArray);
?>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="1" class="action_buttons" style="padding-top: 5px;">
<TR>
	<TD><A HREF="/<?php 
echo $ADMIN;
?>
/sections/?Pub=<?php 
p($f_publication_id);
Ejemplo n.º 5
0
    exit;
}
$publicationObj = new Publication($Pub);
if (!$publicationObj->exists()) {
    camp_html_display_error(getGS('Publication does not exist.'));
    exit;
}
$issueObj = new Issue($Pub, $Language, $Issue);
if (!$issueObj->exists()) {
    camp_html_display_error(getGS('Issue does not exist.'));
    exit;
}
$allLanguages = Language::GetLanguages(null, null, null, array(), array(), true);
// Get translations of this issue
$issueTranslations = Issue::GetIssues($Pub, null, $Issue, null, null, false, null, true);
$excludeLanguageIds = DbObjectArray::GetColumn($issueTranslations, 'IdLanguage');
$allEvents = IssuePublish::GetIssueEvents($Pub, $Issue, $Language);
$publish_date = date("Y-m-d");
$publish_hour = date("H") + 1;
$publish_min = "00";
camp_html_content_top(getGS('Change issue details'), array('Pub' => $publicationObj, 'Issue' => $issueObj), true, true);
$url_args1 = "Pub={$Pub}";
$url_args2 = $url_args1 . "&Issue={$Issue}&Language={$Language}";
$url_args3 = "f_publication_id={$Pub}&f_issue_number={$Issue}&f_language_id={$Language}";
if (Issue::GetNumIssues($Pub) <= 0) {
    $url_add = "add_new.php";
} else {
    $url_add = "qadd.php";
}
//@New theme management
$resourceId = new ResourceId('Publication/Edit');
Ejemplo n.º 6
0
<?php

require_once $GLOBALS['g_campsiteDir'] . "/{$ADMIN_DIR}/topics/topics_common.php";
$f_show_languages = camp_session_get('f_show_languages', array());
$topics = Topic::GetTree();
// return value is sorted by language
$allLanguages = Language::GetLanguages(null, null, null, array(), array(), true);
$loginLanguageId = 0;
$loginLanguage = Language::GetLanguages(null, camp_session_get('TOL_Language', 'en'), null, array(), array(), true);
if (is_array($loginLanguage) && count($loginLanguage) > 0) {
    $loginLanguage = array_pop($loginLanguage);
    $loginLanguageId = $loginLanguage->getLanguageId();
}
if (count($f_show_languages) <= 0) {
    $f_show_languages = DbObjectArray::GetColumn($allLanguages, 'Id');
}
$crumbs = array();
$crumbs[] = array(getGS("Configure"), "");
$crumbs[] = array(getGS("Topics"), "");
echo camp_html_breadcrumbs($crumbs);
camp_html_display_msgs("0.5em", 0);
?>

<form action="" method="post">
<fieldset class="controls">
    <legend><?php 
putGS("Show languages");
?>
</legend>
    <div class="buttons">
        <input type="button" value="<?php 
Ejemplo n.º 7
0
');
            return false;
        }

        // Verify there is a name for the section
        if (form.section_chooser[1].checked && (form.destination_section_new_name.value.trim() == "")) {
            alert('<?php 
putGS("You must specify a name for the section.");
?>
');
            return false;
        }

        // Check if user specified an existing section in the "New Section" dialog.
        existingSections = [ <?php 
p(implode(',', DbObjectArray::GetColumn($allSections, 'Number')));
?>
 ];
        for (i = 0; i < existingSections.length; i++ ) {
            if (newSectionNumber == existingSections[i]) {
                alert('<?php 
putGS("The section number specified already exists, please specify a different value or use the dropdown to find an existing section.");
?>
');
                return false;
            }
        }
    }
    return true;
} // fn CustomValidator_DuplicateSection
</script>
Ejemplo n.º 8
0
        // New Section checking
        // Verify there is a number for the section
        newSectionNumber = form.destination_section_new_id.value.trim();
        if (form.section_chooser[1].checked && (newSectionNumber == "")) {
            alert('<?php putGS("You must select a section."); ?>');
            return false;
        }

        // Verify there is a name for the section
        if (form.section_chooser[1].checked && (form.destination_section_new_name.value.trim() == "")) {
            alert('<?php putGS("You must specify a name for the section."); ?>');
            return false;
        }

        // Check if user specified an existing section in the "New Section" dialog.
        existingSections = [ <?php p(implode(',', DbObjectArray::GetColumn($allSections, 'Number'))); ?> ];
        for (i = 0; i < existingSections.length; i++ ) {
            if (newSectionNumber == existingSections[i]) {
                alert('<?php putGS("The section number specified already exists, please specify a different value or use the dropdown to find an existing section."); ?>');
                return false;
            }
        }
    }
    return true;
} // fn CustomValidator_DuplicateSection
</script>

<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="1" class="action_buttons" style="padding-top: 5px;">
<TR>
	<TD><A HREF="/<?php echo $ADMIN; ?>/sections/?Pub=<?php p($f_src_publication_id); ?>&Issue=<?php p($f_src_issue_number); ?>&Language=<?php p($f_language_id); ?>"><IMG SRC="<?php echo $Campsite["ADMIN_IMAGE_BASE_URL"]; ?>/left_arrow.png" BORDER="0"></A></TD>
	<TD><A HREF="/<?php echo $ADMIN; ?>/sections/?Pub=<?php p($f_src_publication_id); ?>&Issue=<?php p($f_src_issue_number); ?>&Language=<?php p($f_language_id); ?>"><B><?php  putGS("Section List"); ?></B></A></TD>