function sc_get_all_status_select() { $status_terms = get_terms(Sprout_Client::STATUS_TAXONOMY, array('hide_empty' => false)); ob_start(); ?> <div id="statuses_filter" class="sc_statuses_filter"> <span class="status_filter_button" data-sa-dropdown="#filter_status_all"> <?php printf('<button class="sc_filter_status button" title="%1$s">%1$s <span class="dashicons dashicons-arrow-down"></span></button>', esc_attr(sc__('Status'))); ?> </span> <span class="helptip client_filter_help" data-sa-dropdown="#client_status_filter_help_all"></span> <div id="client_status_filter_help_all" class="sa-dropdown sa-dropdown-tip sa-dropdown-relative "> <div class="sa-dropdown-panel"> <?php sc_e('Select all statuses that currently fit this contact.'); ?> </div> </div> <div id="filter_status_all" class="sa-dropdown sa-dropdown-tip sa-dropdown-relative status_filter_selection" data-vertical-offset="50"> <ul class="sa-dropdown-menu"> <?php foreach ($status_terms as $term) { ?> <?php $checked = ''; printf('<li><label><input type="checkbox" value="%1$s" name="%4$s" %3$s/><b>%2$s</b></label></li>', $term->slug, esc_html($term->name), esc_attr($checked), Sprout_Client::STATUS_TAXONOMY); ?> <?php } ?> <li class="sa-dropdown-divider"></li> <li><a href="<?php echo esc_url(admin_url('edit-tags.php?taxonomy=sc_client_status&post_type=sa_client')); ?> "><?php sc_e('Add/Edit Client Statuses'); ?> </a></li> </ul> </div> </div> <?php $view = ob_get_clean(); return apply_filters('sc_get_all_status_select', $view); }
<div id="context_updates" class="clearfix"> <div class="clearfix"> <?php $title = 'auto-draft' !== $post_status ? get_the_title($id) : ''; ?> <div id="titlediv"> <?php if ('' === $title) { ?> <label class="" id="title-prompt-text" for="title"><?php sc_e('Contact Name'); ?> </label> <?php } ?> <input type="text" name="post_title" size="30" value="<?php echo esc_html($title); ?> " id="title"> </div> <div id="sc_type_select"> <?php sc_type_select(); ?> <span class="helptip client_type_help" data-sa-dropdown="#client_type_select_help"></span> <div id="client_type_select_help" class="sa-dropdown sa-dropdown-tip sa-dropdown-relative "> <div class="sa-dropdown-panel"> <?php self::_e('Select the type of client this contact is. If a type does not exist you can always create a new one that better fits.');
</option> <?php } ?> <?php } ?> </select> <span class="helptip associate_user_select_help" data-sa-dropdown="#associate_user_select_help"></span> <div id="associate_user_select_help" class="sa-dropdown sa-dropdown-tip sa-dropdown-relative"> <div class="sa-dropdown-panel"> <?php self::_e('Contacts can have multiple people associated; consider a company/client that may have multiple contacts. Each person may receive notifications depending on what is sent.'); ?> </div> </div> <a href="#TB_inline?width=300&height=250&inlineId=user_creation_modal" id="user_creation_modal_tb_link" class="thickbox button" title="<?php sc_e('Create new user for this lead'); ?> "><?php sc_e('New Person'); ?> </a> <span class="helptip add_user_select_help" data-sa-dropdown="#add_user_select_help"></span> <div id="add_user_select_help" class="sa-dropdown sa-dropdown-tip sa-dropdown-relative"> <div class="sa-dropdown-panel"> <?php self::_e('"People" are WordPress users set with the role of client, they have no permissions by default but providing your contacts a user (which they won\'t know about by default) allows for a whole slew of features and flexibility for customizations.'); ?> </div> </div> </div>
<!-- User Creation Form --> <div id="user_creation_modal" style="display:none;"> <div id="user_create_form" class="clearfix"> <?php sa_form_fields($fields, 'user'); ?> </div> <p> <a href="javascript:void(0)" id="sc_create_user" class="button button-large button-primary"><?php sc_e('Create user'); ?> </a> </p> </div>
<!-- Create Client Form --> <div id="client_creation_modal" style="display:none;"> <div id="client_create_form" class="clearfix"> <?php sa_form_fields($fields, 'client'); ?> </div> <p> <a href="javascript:void(0)" id="create_client" class="button button-large button-primary"><?php sc_e('Create client'); ?> </a> </p> </div>
echo esc_textarea($note); ?> </textarea> <br><span class="description"><?php sc_e('Save some notes about this person.'); ?> </span> </td> </tr> <?php if (!empty($clients)) { ?> <tr> <th> <label for="sc_clients"><?php sc_e('Associated Clients'); ?> </label> </th> <td> <ul> <?php foreach ($clients as $client_id) { ?> <li><?php printf('<a href="%s">%s</a>', get_edit_post_link($client_id), get_the_title($client_id)); ?> </li> <?php } ?>
/** * Loop through the fields set for the form and build the markup. * @param array $fields * @param string $context * @return string */ function sa_admin_fields($fields, $context = 'metabox') { foreach ($fields as $key => $data) { ?> <div id="si_admin_field_<?php echo esc_attr($context); ?> _<?php echo esc_attr($key); ?> " class="form-group<?php if ($data['type'] == 'hidden') { echo ' hidden'; } ?> "> <?php if ($data['type'] == 'heading') { ?> <legend class="legend form-heading" ><?php sc_e($data['label']); ?> </legend> <?php } elseif ($data['type'] != 'checkbox') { ?> <span class="label_wrap"><?php sa_form_label($key, $data, $context); ?> </span> <div class="input_wrap"><?php sa_form_field($key, $data, $context); ?> </div> <?php } else { ?> <div class="checkbox input_wrap"> <label for="sa_<?php echo esc_attr($context); ?> _<?php echo esc_attr($key); ?> "> <?php // add class by modifying the attributes. $data['attributes']['class'] = 'checkbox'; ?> <?php sa_form_field($key, $data, $context); ?> <?php sc_e($data['label']); ?> </label> <?php if (!empty($data['description'])) { ?> <p class="description help_block"><?php sc_e($data['description']); ?> </p> <?php } ?> </div> <?php } ?> </div> <?php } }
function column_data($item) { $record = SC_Record::get_instance($item->ID); $data = $record->get_data(); if ($data != '') { ?> <a href="#TB_inline?width=900&height=600&inlineId=data_id_<?php echo esc_attr($item->ID); ?> " class="thickbox button" title="<?php echo esc_attr($item->post_title); ?> <?php sc_e('Data'); ?> "><?php sc_e('View Data'); ?> </a> <?php if (is_array($data)) { ?> <div id="data_id_<?php echo esc_attr($item->ID); ?> " style="display:none;"><pre style="white-space:pre-wrap; text-align: left; font: normal normal 11px/1.4 menlo, monaco, monospaced; padding: 5px;"><?php print_r($data); ?> </pre></div> <?php } else { ?> <div id="data_id_<?php echo esc_attr($item->ID); ?> " style="display:none;"><?php echo apply_filters('the_content', $data); ?> </div> <?php } ?> <?php } }
/** * Display the content for the column * * @param string $column_name * @param int $id post_id * @return string */ public static function column_display($column_name, $id) { $client = Sprout_Client::get_instance($id); if (!is_a($client, 'Sprout_Client')) { return; // return for that temp post } switch ($column_name) { case 'sc_client_type': sc_type_select($id); break; case 'sc_client_status': sc_status_select($id); break; case 'lead_info': echo '<p>'; $address = si_format_address($client->get_address(), 'string', '<br/>'); print $address; if ('' !== $address) { echo '<br/>'; } echo make_clickable(esc_url($client->get_website())); echo '</p>'; break; case 'contacts': $associated_users = $client->get_associated_users(); echo '<p>'; printf('<b>%s</b>: ', sc__('User Contacts')); if (!empty($associated_users)) { $users_print = array(); foreach ($associated_users as $user_id) { $user = get_userdata($user_id); if (!is_a($user, 'WP_User')) { $client->remove_associated_user($user_id); continue; } $users_print[] = sprintf('<span class="associated_user"><a href="%s">%s</a></span>', get_edit_user_link($user_id), sc_get_users_full_name($user_id)); } } if (!empty($users_print)) { print implode(', ', $users_print); } else { sc_e('No associated people/users.'); } echo '</p>'; break; default: // code... break; } }