Example #1
0
        $return = array();
        $items = array();
        $articleId = $f_params['articleId'];
        if (!is_numeric($articleId)) {
            $articleIdArray = explode('_', $articleId);
            $articleId = $articleIdArray[1];
        }
        $contextBoxObj = new ContextBox(null, $articleId);
        $contextId = $contextBoxObj->getId();
        $contextArticleIds = $contextBoxObj->getArticlesList();
        foreach ($contextArticleIds as $contextArticleId) {
            $articleObj = new Article($f_language_selected, $contextArticleId);
            $item['title'] = $articleObj->getTitle();
            $item['articleId'] = 'article_' . $contextArticleId;
            $item['date'] = $articleObj->getCreationDate();
            $item['status'] = $articleObj->getWorkflowDisplayString();
            $items[] = $item;
        }
        $return['items'] = $items;
        $return['code'] = 200;
        return $return;
        break;
}
if ($f_target == 'art_ofp') {
    $value = $f_value == 'Yes' ? true : false;
    $success = $articleObj->setOnFrontPage($value);
    $message = $translator->trans("\$1 toggled.", array('$1' => """ . $translator->trans("On Front Page") . """), 'library');
}
if ($f_target == 'art_osp') {
    $value = $f_value == 'Yes' ? true : false;
    $success = $articleObj->setOnSectionPage($value);
Example #2
0
 /**
  * Process item
  * @param  Article $article
  * @return array
  */
 public function processItem(Article $article)
 {
     global $g_user, $Campsite;
     $translator = \Zend_Registry::get('container')->getService('translator');
     return array($article->getArticleNumber(), $article->getLanguageId(), sprintf('
             <div class="context-item" langid="%s">
                 <div class="context-drag-topics"><a href="#" title="drag to sort"></a></div>
                 <div class="context-item-header">
                     <div class="context-item-date">%s (%s) (%s)</div>
                     <a href="#" class="view-article" onClick="viewArticle($(this).parent(\'div\').parent(\'div\').parent(\'td\').parent(\'tr\').attr(\'id\'), $(this).parents(\'.context-item:eq(0)\').attr(\'langid\'));">%s</a>
                 </div>
                 <a href="javascript:void(0)" class="corner-button" style="display: none" onClick="removeFromContext($(this).parent(\'div\').parent(\'td\').parent(\'tr\').attr(\'id\'));removeFromContext($(this).parents(\'.item:eq(0)\').attr(\'id\'));toggleDragZonePlaceHolder();"><span class="ui-icon ui-icon-closethick"></span></a>
                 <div class="context-item-summary">%s</div>
                 </div>
         ', $article->getLanguageId(), $article->getLastModified(), $article->getWorkflowDisplayString(), $article->getType(), $translator->trans('View article', array(), 'library'), $article->getName()));
 }
Example #3
0
                break;
            case 'Published':
                $f_value = 'Y';
                break;
            case 'Submitted':
                $f_value = 'S';
                break;
        }
        $access = false;
        // A publisher can change the status in any way he sees fit.
        // Someone who can change an article can submit/unsubmit articles.
        // A user who owns the article may submit it.
        if ($g_user->hasPermission('Publish') || $g_user->hasPermission('ChangeArticle') && $f_value != 'Y' || $articleObj->userCanModify($g_user) && $f_value == 'S') {
            $access = true;
        }
        // If the article is not yet categorized, force it to be before publication.
        if ($f_action_workflow == "Y" && ($articleObj->getPublicationId() == 0 || $articleObj->getIssueNumber() == 0 || $articleObj->getSectionNumber() == 0)) {
            //$args = $_REQUEST;
            //$argsStr = camp_implode_keys_and_values($_REQUEST, "=", "&");
            //$argsStr .= "&f_article_code[]=".$f_article_number."_".$f_language_selected;
            //$argsStr .= "&f_mode=single&f_action=publish";
            //camp_html_goto_page("/$ADMIN/articles/duplicate.php?".$argsStr);
        }
        $success = $articleObj->setWorkflowStatus($f_value);
        $message = getGS("Article status set to '\$1'", $articleObj->getWorkflowDisplayString($f_value));
    }
}
if ($affectedArticles == 0 && $success) {
    $affectedArticles = 1;
}
return returnJson($affectedArticles, $message, $notAffectedArticles, $errorMessage, $hiperlink);