function get_pages_needing_change() { if (!isset($this->pages_needing_change)) { $es = new entity_selector(); $es->add_type(id_of('minisite_page')); $es->enable_multivalue_results(); $es->limit_tables('page_node'); $es->limit_fields('custom_page'); $es->add_relation('page_node.custom_page = "blurb"'); $es->add_left_relationship_field('minisite_page_to_text_blurb', 'entity', 'id', 'blurb_id'); $result = $es->run_one(); foreach ($result as $k => $page) { $blurbs = is_array($page->get_value('blurb_id')) ? $page->get_value('blurb_id') : array($page->get_value('blurb_id')); foreach ($blurbs as $blurb_id) { $blurb = new entity($blurb_id); $content = $blurb->get_value('content'); $demoted_content = demote_headings($content, 1); if ($content == $demoted_content) { $pages_needing_page_type_change[$k] = $k; } } } $this->pages_needing_change = isset($pages_needing_page_type_change) ? array_keys($pages_needing_page_type_change) : false; } return $this->pages_needing_change; }
function get_issue_blurbs_markup() { if (!empty($this->passed_vars['issue_blurbs'])) { $ret = '<div class="issueBlurbs">'; foreach ($this->passed_vars['issue_blurbs'] as $blurb) { $ret .= '<div class="issueBlurb">' . demote_headings($blurb->get_value('content'), 1) . '</div>' . "\n"; } $ret .= '</div>' . "\n"; return $ret; } return ''; }
function display_sub_policy($policy) { echo '<div class="policy sub_policy">'."\n"; echo '<a id="'.$policy->id().'"></a>'; echo "<h4 class='policyName'>" . $policy->get_value('name') . "</h4>\n"; if($policy->get_value( 'content' )) { echo '<div class="policyContent">'.demote_headings($policy->get_value( 'content' ),2) . '</div>'; } $this->display_sub_policies($policy, false); }
function show_child_page($child, $counter, $even_odd) { /* If the page has a link name, use that; otherwise, use its name */ $page_name = $this->get_page_name($child); $title_attr = ''; if ($page_name != $child->get_value('name')) { $title_attr = ' title="' . reason_htmlspecialchars(strip_tags($child->get_value('name')), ENT_QUOTES) . '"'; } $page_name = strip_tags($page_name, '<span><strong><em>'); $link = $this->get_page_link($child); $classes = array('number' . $counter, $even_odd); $uname = ''; if ($child->get_value('unique_name')) { $classes[] = 'uname-' . reason_htmlspecialchars($child->get_value('unique_name')); } if ($child->get_value('url')) { $classes[] = 'jump'; } echo '<li class="' . implode(' ', $classes) . '">'; if ($this->params['provide_az_links'] && array_key_exists($child->id(), $this->az)) { echo '<a name="child_' . $this->az[$child->id()] . '"></a>'; } $image_markup = ''; if ($this->params['provide_images']) { $image = $this->get_page_image($child->id()); if (!empty($image)) { if ($this->params['thumbnail_width'] != 0 or $this->params['thumbnail_height'] != 0) { $rsi = new reasonSizedImage(); if (!empty($rsi)) { $rsi->set_id($image->id()); if ($this->params['thumbnail_width'] != 0) { $rsi->set_width($this->params['thumbnail_width']); } if ($this->params['thumbnail_height'] != 0) { $rsi->set_height($this->params['thumbnail_height']); } if ($this->params['thumbnail_crop'] != '') { $rsi->set_crop_style($this->params['thumbnail_crop']); } if (!$this->params['html5']) { $image_markup = get_show_image_html($rsi, true, false, false, '', '', false, $link); } else { $image_markup = get_show_image_html($rsi, true, false, false, '', '', false); } } } else { if (!$this->params['html5']) { $image_markup = get_show_image_html($image->id(), true, false, false, '', '', false, $link); } else { $image_markup = get_show_image_html($image->id(), true, false, false, '', '', false); } } } if (!$this->params['html5']) { echo $image_markup; } } if ($this->params['description_part_of_link']) { $element = $this->params['html5'] ? 'h4' : 'strong'; echo '<a href="' . $link . '"' . $title_attr . '>'; if ($this->params['html5']) { echo $image_markup; } echo '<' . $element . '>' . $page_name . '</' . $element . '>'; if (!$this->params['html5']) { echo '<br />'; } if ($child->get_value('description')) { $element = $this->params['html5'] ? 'div' : 'span'; echo "\n" . '<' . $element . ' class="childDesc">' . $child->get_value('description') . '</' . $element . '>'; } echo '</a>'; } else { echo $image_markup; echo '<h4><a href="' . $link . '"' . $title_attr . '>' . $page_name . '</a></h4>'; if ($child->get_value('description')) { echo "\n" . '<div class="childDesc">' . $child->get_value('description') . '</div>'; } } if (!empty($this->params['blurbs_count'])) { if ($blurbs = $this->get_blurbs_for_page($child, $this->params['blurbs_count'])) { echo '<div class="childBlurbs">'; foreach ($blurbs as $blurb) { echo '<div class="childBlurb">'; echo demote_headings($blurb->get_value('content'), 2); echo '</div>'; } echo '</div>'; } } echo '</li>' . "\n"; }
function run() { $inline_editing =& get_reason_inline_editing($this->page_id); $editing_available = $inline_editing->available_for_module($this); $editing_active = $inline_editing->active_for_module($this); echo '<div class="blurbs ' . $this->get_api_class_string() . '">' . "\n"; $i = 0; $class = 'odd'; foreach ($this->blurbs as $blurb) { $editable = $editing_available && $this->_blurb_is_editable($blurb); $editing_item = $editing_available && $editing_active && $this->request['blurb_id'] == $blurb->id(); $i++; echo '<div class="blurb number' . $i; if ($blurb->get_value('unique_name')) { echo ' uname_' . htmlspecialchars($blurb->get_value('unique_name')); } if ($editable) { echo ' editable'; } if ($editing_item) { echo ' editing'; } echo ' ' . $class; echo '">'; if ($editing_item) { if ($pages = $this->_blurb_also_appears_on($blurb)) { $num = count($pages); echo '<div class="note"><strong>Note:</strong> Any edits you make here will also change this blurb on the ' . $num . ' other page' . ($num > 1 ? 's' : '') . ' where it appears.</div>'; } echo $this->_get_editing_form($blurb); } else { echo demote_headings($blurb->get_value('content'), $this->params['demote_headings']); if ($editable) { $params = array_merge(array('blurb_id' => $blurb->id()), $inline_editing->get_activation_params($this)); echo '<div class="edit"><a href="' . carl_make_link($params) . '">Edit Blurb</a></div>' . "\n"; } } echo '</div>' . "\n"; $class = 'odd' == $class ? 'even' : 'odd'; } if (!empty($this->params['footer_html'])) { echo '<div class="blurbsFooter">'; echo $this->params['footer_html']; echo '</div>' . "\n"; } echo '</div>' . "\n"; }