/** * Add this object's home page to the location. * @param NAMED_OBJECT $obj The object to add to the location. * @param string $page_args The optional arguments to include in the link's query arguments. * @param string $icon The optional icon to include with the object's menu item. */ public function add_object_link($obj, $page_args = '', $icon = '') { // Don't allow objects in the list to set the style of the navigation bar. $t = $obj->title_formatter(); $t->css_class = 'nav-item'; if ($page_args) { $t->add_arguments($page_args); } $this->append($obj->title_as_link($t), '', $icon); }
/** * @param SUBSCRIBER $subscriber * @param NAMED_OBJECT $obj * @param string $page_name * @param bool $subscribed * @param bool $include_return_url * @param string $caption */ protected function show_subscription($subscriber, $obj, $page_name, $subscribed, $include_return_url, $caption) { if (!$caption) { $type_info = $obj->type_info(); $caption = strtolower($type_info->singular_title); } $url = new URL($obj->home_page()); $url->replace_name_and_extension($page_name); $url->add_argument('subscribed', !$subscribed); $url->add_argument('email', $subscriber->email); if ($include_return_url) { $url->add_argument('return_url', urlencode($this->env->url(Url_part_no_host))); } echo '<tr>'; echo '<th>' . $caption . '</th>'; echo '<td>' . $obj->title_as_link() . '</td>'; echo '<td>' . ($subscribed ? 'subscribed' : '<strong>not</strong> subscribed') . '</td>'; echo '<td><a class="button" href="' . $url->as_html() . '">' . ($subscribed ? 'Unsubscribe' : 'Subscribe') . '</a></td>'; echo '</tr>'; }