protected function buildInternal() { parent::buildInternal(); if ($this->extended_selected) { // note the only page with an extended-selection that accesses this // is the pending photos page - so the message can be more // specific. $message = $this->ui->getWidget('confirmation_message'); $message->content_type = 'text/xml'; $message->content = Pinhole::_('<strong>Are you sure ' . 'you want to delete all pending photos?</strong>'); } else { $container = $this->ui->getWidget('confirmation_container'); $delete_view = $this->ui->getWidget('delete_view'); $store = new SwatTableStore(); foreach ($this->getPhotos() as $photo) { $ds = new SwatDetailsStore(); $ds->photo = $photo; $store->add($ds); } $delete_view->model = $store; $message = $this->ui->getWidget('confirmation_message'); $message->content_type = 'text/xml'; $message->content = sprintf(Pinhole::_('<strong>Are you sure ' . 'you want to delete the following %s?</strong>'), Pinhole::ngettext('photo', 'photos', count($store))); } }
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(); } }
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(); } }
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(); } }
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(); } }
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'; }
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(); } }
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(); } }
protected function buildInternal() { parent::buildInternal(); $item_list = $this->getItemList('integer'); $blocks = SwatDB::query($this->app->db, sprintf('select * from Block where id in (%s)', $this->getItemList('integer')), SwatDBClassMap::get('BuildingBlockWrapper')); $view = SiteViewFactory::get($this->app, 'building-block'); $view->getImageView()->setImageDimensionShortname('thumb'); ob_start(); $header = new SwatHtmlTag('h1'); $header->setContent('Delete the following content?'); $header->display(); foreach ($blocks as $block) { $view->display($block); } $message = $this->ui->getWidget('confirmation_message'); $message->content = ob_get_clean(); $message->content_type = 'text/xml'; }
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(); } }
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 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(); } }