/** * Callback used to render the log view of the log type being viewed. * * @access private * @since 8.3 * @static * * @uses current_user_can() * @uses wp_list_pluck() * @uses esc_url() * @uses self_admin_url() * @uses cnLog::types() * @uses cnLog_Email::types() * @uses cnHTML::select() * @uses submit_button() * @uses do_action() */ public static function logs() { if (!current_user_can('install_plugins')) { return; } $current = cnLog_Email::LOG_TYPE; $views = wp_list_pluck(cnLog::views(), 'id'); if (isset($_GET['view']) && array_key_exists($_GET['view'], $views)) { $current = $_GET['view']; } ?> <div class="wrap" id="cn-logs"> <form id="cn-log-type" method="get" action="<?php echo esc_url(self_admin_url('admin.php')); ?> "> <input type="hidden" name="page" value="connections_tools"/> <input type="hidden" name="tab" value="logs"/> <?php $allLogTypes = wp_list_pluck(cnLog::types(), 'name', 'id'); $emailLogTypes = wp_list_pluck(cnLog_Email::types(), 'name', 'id'); unset($emailLogTypes[cnLog_Email::LOG_TYPE]); cnHTML::select(array('id' => 'view', 'options' => array_diff_assoc($allLogTypes, $emailLogTypes)), $current); submit_button('Switch', 'secondary', 'action', FALSE, array('id' => 'log-type-submit')); ?> </form> <?php do_action('cn_logs_view_' . $current); ?> </div> <?php }
/** * Email log type filter. * * @access protected * @since 8.3 * * @param string $which */ protected function extra_tablenav($which) { if ('top' !== $which) { return; } $emailLogTypes = wp_list_pluck(cnLog_Email::types(), 'name', 'id'); unset($emailLogTypes[cnLog_Email::LOG_TYPE]); cnHTML::select(array('id' => 'type', 'default' => array(-1 => __('View All', 'connections')), 'options' => $emailLogTypes), $this->type); submit_button('Filter', 'secondary', 'filter_action', FALSE, array('id' => 'email-log-query-submit')); }
/** * Callback to render the 'family' entry type part of the 'Name' metabox. * Called from self::name() * * @access private * @since 0.8 * * @param cnEntry $entry An instance of the cnEntry object. * @param array $atts The metabox attributes array set in self::register(). Passed from self::name(). * * @return void */ public static function family($entry, $atts) { // Grab an instance of the Connections object. $instance = Connections_Directory(); $html = ''; $id = $entry->getId(); $ckey = $entry->getId() ? 'relative_select_entry_' . $id : 'relative_select_user_' . $instance->currentUser->getID(); if (FALSE !== ($cache = cnCache::get($ckey, 'transient'))) { echo $cache; return; } // Retrieve all the entries of the "individual" entry type that the user is permitted to view and is approved. $individuals = cnRetrieve::individuals(); // Get the core entry relations. $options = $instance->options->getDefaultFamilyRelationValues(); $html .= '<div class="cn-metabox" id="cn-metabox-section-family">'; // --> Start template for Family <-- \\ $html .= '<textarea id="cn-relation-template" style="display: none">'; $html .= cnHTML::select(array('class' => 'family-member-name', 'id' => 'family_member[::FIELD::][entry_id]', 'default' => __('Select Entry', 'connections'), 'options' => $individuals, 'enhanced' => TRUE, 'return' => TRUE)); $html .= cnHTML::select(array('class' => 'family-member-relation', 'id' => 'family_member[::FIELD::][relation]', 'default' => __('Select Relation', 'connections'), 'options' => $options, 'enhanced' => TRUE, 'return' => TRUE)); $html .= '</textarea>'; // --> End template for Family <-- \\ $html .= '<label for="family_name">' . __('Family Name', 'connections') . ':</label>'; $html .= '<input type="text" name="family_name" value="' . $entry->getFamilyName() . '" />'; $html .= '<ul id="cn-relations">'; if ($relations = $entry->getFamilyMembers()) { foreach ($relations as $relationData) { $token = str_replace('-', '', cnUtility::getUUID()); if (array_key_exists($relationData['entry_id'], $individuals)) { $html .= '<li id="relation-row-' . $token . '" class="cn-relation"><i class="fa fa-sort"></i> '; $html .= cnHTML::select(array('class' => 'family-member-name', 'id' => 'family_member[' . $token . '][entry_id]', 'default' => __('Select Entry', 'connections'), 'options' => $individuals, 'enhanced' => TRUE, 'return' => TRUE), $relationData['entry_id']); $html .= cnHTML::select(array('class' => 'family-member-relation', 'id' => 'family_member[' . $token . '][relation]', 'default' => __('Select Relation', 'connections'), 'options' => $options, 'enhanced' => TRUE, 'return' => TRUE), $relationData['relation']); $html .= '<a href="#" class="cn-remove cn-button button cn-button-warning" data-type="relation" data-token="' . $token . '">' . __('Remove', 'connections') . '</a>'; $html .= '</li>'; } } } $html .= '</ul>'; $html .= '<p class="add"><a id="add-relation" class="button">' . __('Add Relation', 'connections') . '</a></p>'; $html .= '</div>'; cnCache::set($ckey, $html, YEAR_IN_SECONDS, 'transient'); echo $html; }