Ejemplo n.º 1
0
 public static function onActionLegacy($core, dcPostsActionsPage $as, $post)
 {
     $core->callBehavior('adminPostsActions', $core, $as->getRS(), $as->getAction(), $as->getRedirection());
     $as->beginPage('', dcPage::jsLoad('js/jquery/jquery.autocomplete.js') . dcPage::jsMetaEditor() . $core->callBehavior('adminPostsActionsHeaders'), '');
     $core->callBehavior('adminPostsActionsContent', $core, $as->getAction(), $as->getHiddenFields(true));
     $as->endPage();
 }
Ejemplo n.º 2
0
 public static function adminRemoveTags($core, dcPostsActionsPage $ap, $post)
 {
     if (!empty($post['meta_id']) && $core->auth->check('delete,contentadmin', $core->blog->id)) {
         $meta =& $core->meta;
         $posts = $ap->getRS();
         while ($posts->fetch()) {
             foreach ($_POST['meta_id'] as $v) {
                 $meta->delPostMeta($posts->post_id, 'tag', $v);
             }
         }
         dcPage::addSuccessNotice(sprintf(__('Tag has been successfully removed from selected entries', 'Tags have been successfully removed from selected entries', count($_POST['meta_id']))));
         $ap->redirect(true);
     } else {
         $meta =& $core->meta;
         $tags = array();
         foreach ($ap->getIDS() as $id) {
             $post_tags = $meta->getMetadata(array('meta_type' => 'tag', 'post_id' => (int) $id))->toStatic()->rows();
             foreach ($post_tags as $v) {
                 if (isset($tags[$v['meta_id']])) {
                     $tags[$v['meta_id']]++;
                 } else {
                     $tags[$v['meta_id']] = 1;
                 }
             }
         }
         if (empty($tags)) {
             throw new Exception(__('No tags for selected entries'));
         }
         $ap->beginPage(dcPage::breadcrumb(array(html::escapeHTML($core->blog->name) => '', __('Entries') => 'posts.php', __('Remove selected tags from this selection') => '')));
         $posts_count = count($_POST['entries']);
         echo '<form action="' . $ap->getURI() . '" method="post">' . $ap->getCheckboxes() . '<div><p>' . __('Following tags have been found in selected entries:') . '</p>';
         foreach ($tags as $k => $n) {
             $label = '<label class="classic">%s %s</label>';
             if ($posts_count == $n) {
                 $label = sprintf($label, '%s', '<strong>%s</strong>');
             }
             echo '<p>' . sprintf($label, form::checkbox(array('meta_id[]'), html::escapeHTML($k)), html::escapeHTML($k)) . '</p>';
         }
         echo '<p><input type="submit" value="' . __('ok') . '" />' . $core->formNonce() . $ap->getHiddenFields() . form::hidden(array('action'), 'tags_remove') . '</p></div></form>';
         $ap->endPage();
     }
 }