Example #1
0
    protected function buildInternal()
    {
        parent::buildInternal();
        $item_list = $this->getItemList('integer');
        $instance_id = $this->app->getInstanceId();
        $dep = new AdminListDependency();
        $dep->setTitle(Blorg::_('post'), Blorg::_('posts'));
        $sql = sprintf('select id, title, bodytext from BlorgPost
			where instance %s %s and id in (%s)
			order by publish_date desc, title', SwatDB::equalityOperator($instance_id), $this->app->db->quote($instance_id, 'integer'), $item_list);
        $posts = SwatDB::query($this->app->db, $sql, 'BlorgPostWrapper');
        $entries = array();
        foreach ($posts as $post) {
            $entry = new AdminDependencyEntry();
            $entry->id = $post->id;
            $entry->title = $post->getTitle();
            $entry->status_level = AdminDependency::DELETE;
            $entry->parent = null;
            $entries[] = $entry;
        }
        $dep->entries = $entries;
        $message = $this->ui->getWidget('confirmation_message');
        $message->content = $dep->getMessage();
        $message->content_type = 'text/xml';
        if ($dep->getStatusLevelCount(AdminDependency::DELETE) == 0) {
            $this->switchToCancelButton();
        }
    }
Example #2
0
    protected function buildInternal()
    {
        parent::buildInternal();
        $item_list = $this->getItemList('integer');
        $instance_id = $this->app->getInstanceId();
        $dep = new AdminListDependency();
        $dep->setTitle(Blorg::_('comment'), Blorg::_('comments'));
        $sql = sprintf('select BlorgComment.id, BlorgComment.bodytext from BlorgComment
				inner join BlorgPost on BlorgPost.id = BlorgComment.post
			where instance %s %s and BlorgComment.id in (%s)
			order by BlorgComment.createdate desc, BlorgComment.id', SwatDB::equalityOperator($instance_id), $this->app->db->quote($instance_id, 'integer'), $item_list);
        $comments = SwatDB::query($this->app->db, $sql);
        $entries = array();
        foreach ($comments as $comment) {
            $entry = new AdminDependencyEntry();
            $entry->id = $comment->id;
            $entry->title = SwatString::ellipsizeRight(SwatString::condense(SiteCommentFilter::toXhtml($comment->bodytext)), 100);
            $entry->status_level = AdminDependency::DELETE;
            $entry->parent = null;
            $entries[] = $entry;
        }
        $dep->entries = $entries;
        $message = $this->ui->getWidget('confirmation_message');
        $message->content = $dep->getMessage();
        $message->content_type = 'text/xml';
        if ($dep->getStatusLevelCount(AdminDependency::DELETE) == 0) {
            $this->switchToCancelButton();
        }
    }
Example #3
0
    protected function buildInternal()
    {
        parent::buildInternal();
        $locale = SwatI18NLocale::get();
        $item_list = $this->getItemList('integer');
        $dep = new AdminListDependency();
        $dep->setTitle(CME::_('CME front matter'), CME::_('CME front matters'));
        $sql = sprintf('select CMEFrontMatter.id, sum(CMECredit.hours) as hours
			from CMEFrontMatter
			left outer join CMECredit
				on CMECredit.front_matter = CMEFrontMatter.id
			where CMEFrontMatter.id in (%s)
			group by CMEFrontMatter.id', $item_list);
        $rs = SwatDB::query($this->app->db, $sql);
        $class_name = SwatDBClassMap::get('CMEFrontMatter');
        foreach ($rs as $row) {
            $front_matter = new $class_name($row);
            $front_matter->setDatabase($this->app->db);
            $row->status_level = AdminDependency::DELETE;
            $row->parent = null;
            // not using ngettext because hours is a float
            $row->title = sprintf($row->hours == 1 ? CME::_('%s (1 hour)') : CME::_('%s (%s hours)'), $front_matter->getProviderTitleList(), $locale->formatNumber($row->hours));
            $dep->entries[] = new AdminDependencyEntry($row);
        }
        $message = $this->ui->getWidget('confirmation_message');
        $message->content = $dep->getMessage();
        $message->content_type = 'text/xml';
        if ($dep->getStatusLevelCount(AdminDependency::DELETE) === 0) {
            $this->switchToCancelButton();
        }
    }
Example #4
0
    protected function buildInternal()
    {
        parent::buildInternal();
        $locale = SwatI18NLocale::get();
        $item_list = $this->getItemList('integer');
        $dep = new AdminListDependency();
        $dep->setTitle(CME::_('CME credit'), CME::_('CME credits'));
        $sql = sprintf('select CMECredit.*
			from CMECredit
			where CMECredit.id in (%s)', $item_list);
        $credits = SwatDB::query($this->app->db, $sql, SwatDBClassMap::get('CMECreditWrapper'));
        foreach ($credits as $credit) {
            $data = new stdClass();
            $data->id = $credit->id;
            $data->status_level = AdminDependency::DELETE;
            $data->parent = null;
            $data->title = $credit->getTitle();
            $dep->entries[] = new AdminDependencyEntry($data);
        }
        $message = $this->ui->getWidget('confirmation_message');
        $message->content = $dep->getMessage();
        $message->content_type = 'text/xml';
        if ($dep->getStatusLevelCount(AdminDependency::DELETE) === 0) {
            $this->switchToCancelButton();
        }
    }
Example #5
0
 public function buildInternal()
 {
     parent::buildInternal();
     $item_list = $this->getItemList('integer');
     $instance_id = $this->app->getInstanceId();
     $where_clause = sprintf('id in (%s) and instance %s %s', $item_list, SwatDB::equalityOperator($instance_id), $this->app->db->quote($instance_id, 'integer'));
     $dep = new AdminListDependency();
     $dep->setTitle(Pinhole::_('photographer'), Pinhole::_('photographers'));
     $dep->entries = AdminListDependency::queryEntries($this->app->db, 'PinholePhotographer', 'integer:id', null, 'text:fullname', 'fullname', $where_clause, AdminDependency::DELETE);
     $message = $this->ui->getWidget('confirmation_message');
     $message->content = $dep->getMessage();
     $message->content_type = 'text/xml';
 }
Example #6
0
 protected function buildInternal()
 {
     parent::buildInternal();
     $item_list = $this->getItemList('integer');
     $dep = new AdminListDependency();
     $dep->setTitle('tag', 'tags');
     $dep->entries = AdminListDependency::queryEntries($this->app->db, 'BlorgTag', 'integer:id', null, 'text:title', 'id', 'id in (' . $item_list . ')', AdminDependency::DELETE);
     $message = $this->ui->getWidget('confirmation_message');
     $message->content = $dep->getMessage();
     $message->content_type = 'text/xml';
     if ($dep->getStatusLevelCount(AdminDependency::DELETE) == 0) {
         $this->switchToCancelButton();
     }
 }
Example #7
0
 protected function buildInternal()
 {
     AdminDBDelete::buildInternal();
     $item_list = $this->getItemList('integer');
     $instance_id = $this->app->getInstanceId();
     $where_clause = sprintf('id in (%s) and instance %s %s', $item_list, SwatDB::equalityOperator($instance_id), $this->app->db->quote($instance_id, 'integer'));
     $dep = new AdminListDependency();
     $dep->setTitle(Site::_('article'), Site::_('articles'));
     $dep->entries = AdminListDependency::queryEntries($this->app->db, 'Article', 'integer:id', null, 'text:title', 'title', $where_clause, AdminDependency::DELETE);
     $this->getDependencies($dep, $item_list);
     $message = $this->ui->getWidget('confirmation_message');
     $message->content = $dep->getMessage();
     $message->content_type = 'text/xml';
     if ($dep->getStatusLevelCount(AdminDependency::DELETE) === 0) {
         $this->switchToCancelButton();
     }
 }
Example #8
0
 protected function buildInternal()
 {
     parent::buildInternal();
     $item_list = $this->getItemList('integer');
     $instance_id = $this->app->getInstanceId();
     $where_clause = sprintf('id in (%s) and instance %s %s', $item_list, SwatDB::equalityOperator($instance_id), $this->app->db->quote($instance_id, 'integer'));
     $dep = new AdminListDependency();
     $dep->setTitle('author', 'authors');
     $dep->entries = AdminListDependency::queryEntries($this->app->db, 'BlorgAuthor', 'integer:id', null, 'text:name', 'id', $where_clause, AdminDependency::DELETE);
     $dep_posts = new AdminSummaryDependency();
     $dep_posts->setTitle(Blorg::_('post'), Blorg::_('posts'));
     $dep_posts->summaries = AdminSummaryDependency::querySummaries($this->app->db, 'BlorgPost', 'integer:id', 'integer:author', 'author in (' . $item_list . ')', AdminDependency::NODELETE);
     $dep->addDependency($dep_posts);
     $message = $this->ui->getWidget('confirmation_message');
     $message->content = $dep->getMessage();
     $message->content_type = 'text/xml';
     if ($dep->getStatusLevelCount(AdminDependency::DELETE) == 0) {
         $this->switchToCancelButton();
     }
 }
Example #9
0
 protected function buildInternal()
 {
     parent::buildInternal();
     if ($this->extended_selected) {
         $message = $this->ui->getWidget('confirmation_message');
         $message->content = Pinhole::_('Are you sure you want ' . 'to delete <strong>all tags</strong>?');
         $message->content_type = 'text/xml';
     } else {
         $item_list = $this->getItemList('integer');
         $instance_id = $this->app->getInstanceId();
         $where_clause = sprintf('id in (%s) and instance %s %s', $item_list, SwatDB::equalityOperator($instance_id), $this->app->db->quote($instance_id, 'integer'));
         $dep = new AdminListDependency();
         $dep->setTitle(Pinhole::_('tag'), Pinhole::_('tags'));
         $dep->entries = AdminListDependency::queryEntries($this->app->db, 'PinholeTag', 'integer:id', null, 'text:title', 'title', $where_clause, AdminDependency::DELETE);
         $message = $this->ui->getWidget('confirmation_message');
         $message->content = $dep->getMessage();
         $message->content_type = 'text/xml';
         if ($dep->getStatusLevelCount(AdminDependency::DELETE) == 0) {
             $this->switchToCancelButton();
         }
     }
 }
 protected function getStatusLevelText($status_level, $count)
 {
     switch ($status_level) {
         case self::DELETE:
             $message = sprintf(CME::ngettext('Reset the following %s?', 'Reset the following %s?', $count), $this->getTitle($count));
             break;
         case self::NODELETE:
             $message = sprintf(CME::ngettext('The following %s can not be reset:', 'The following %s can not be reset:', $count), $this->getTitle($count));
             break;
         default:
             $message = parent::getStatusLevelText($status_level, $count);
             break;
     }
     return $message;
 }
Example #11
0
 protected function buildInternal()
 {
     parent::buildInternal();
     $dep = new AdminListDependency();
     $dep->setTitle(Deliverance::_('newsletter'), Deliverance::_('newsletters'));
     $entries = array();
     $newsletters = $this->getNewsletters();
     foreach ($newsletters as $newsletter) {
         $entry = new AdminDependencyEntry();
         $entry->title = $newsletter->getCampaignTitle();
         $entry->status_level = $newsletter->isSent() ? AdminDependency::NODELETE : AdminDependency::DELETE;
         $entries[] = $entry;
     }
     $dep->entries = $entries;
     $message = $this->ui->getWidget('confirmation_message');
     $message->content = $dep->getMessage();
     $message->content_type = 'text/xml';
     if ($dep->getStatusLevelCount(AdminDependency::DELETE) == 0) {
         $this->switchToCancelButton();
     }
 }