public static function getTweets($twitter_user) { $i = 0; $twitter_url = 'http://twitter.com/statuses/user_timeline/' . $twitter_user . '.xml?count=4'; $tweets = array(); if ($buffer = @file_get_contents($twitter_url)) { libxml_use_internal_errors(); try { $xml = @new \SimpleXMLElement($buffer); if ($xml->status) { foreach ($xml->status as $status) { $tweet = $status->text; $date = $status->created_at; $id = $status->id; //Turn all urls, hastags, and @mentions into links $tweet = preg_replace("#(^|[\n ])([\\w]+?://[\\w]+[^ \"\n\r\t< ]*)#", "\\1<a href=\"\\2\">\\2</a>", $tweet); $tweet = preg_replace("#(^|[\n ])((www|ftp)\\.[^ \"\t\n\r< ]*)#", "\\1<a href=\"http://\\2\">\\2</a>", $tweet); $tweet = preg_replace("/@(\\w+)/", "<a href=\"http://twitter.com/\\1\">@\\1</a>", $tweet); $tweet = preg_replace("/#(\\w+)/", "<span class='twitter_hash'><a href=\"http://search.twitter.com/search?q=\\1\">#\\1</a></span>", $tweet); $formatted_date = DateHelper::formatDate($date); $tweets[$i]['tweet'] = $tweet; $tweets[$i]['date'] = $formatted_date; $i++; } } } catch (\Exception $e) { } } return $tweets; }
public function testFormatDates() { Localization::changeLocale('en_US'); $activeUser = User::isLoggedIn() ? new User() : null; if ($activeUser) { $activeUser->logout(); } $timestamp = time(); $this->assertEquals($this->object->date(DATE_APP_GENERIC_MDY, $timestamp), $this->object->formatDate($timestamp, false)); $this->assertEquals($this->object->date(DATE_APP_GENERIC_MDY_FULL, $timestamp), $this->object->formatDate($timestamp, true)); $this->assertEquals($this->object->date(DATE_APP_GENERIC_T, $timestamp), $this->object->formatTime($timestamp, false)); $this->assertEquals($this->object->date(DATE_APP_GENERIC_TS, $timestamp), $this->object->formatTime($timestamp, true)); $this->assertEquals($this->object->date(DATE_APP_GENERIC_MDYT, $timestamp), $this->object->formatDateTime($timestamp, false, false)); /* $this->assertEquals( $this->object->date(, $timestamp), $this->object->formatDateTime($timestamp, false, true) ); */ $this->assertEquals($this->object->date(DATE_APP_GENERIC_MDYT_FULL, $timestamp), $this->object->formatDateTime($timestamp, true, false)); $this->assertEquals($this->object->date(DATE_APP_GENERIC_MDYT_FULL_SECONDS, $timestamp), $this->object->formatDateTime($timestamp, true, true)); if ($activeUser) { User::getByUserID($activeUser->getUserID(), true); } }
public static function formatTourDate($str, $glue) { $date = explode(',', $str); $result = array(); for ($i = 0; $i < count($date); $i++) { $result[] = DateHelper::formatDate($date[$i]); } return implode($glue, $result); }
public function testTimeSince() { Localization::changeLocale("en_US"); $minutes = 60; $hours = $minutes * 60; $days = $hours * 24; // time is in the future $future = time() + 7; $this->assertEquals($this->object->formatDate($future), $this->object->timeSince($future)); // time is now $this->assertEquals("0 seconds", $this->object->timeSince(time())); // time is in the past $this->assertEquals("7 seconds", $this->object->timeSince(time() - 7)); $this->assertEquals("3 minutes", $this->object->timeSince(time() - (3 * $minutes + 13))); $this->assertEquals("3 minutes, 13 seconds", $this->object->timeSince(time() - (3 * $minutes + 13), 1)); $this->assertEquals("4 hours", $this->object->timeSince(time() - (4 * $hours + 2 * $minutes))); $this->assertEquals("4 hours, 1 minute", $this->object->timeSince(time() - (4 * $hours + 1 * $minutes), 1)); $this->assertEquals("1 day", $this->object->timeSince(time() - (1 * $days + 1 * $minutes))); $this->assertEquals("2 days, 2 hours", $this->object->timeSince(time() - (2 * $days + 2 * $hours), 1)); $this->assertEquals('145 days', $this->object->timeSince(time() - 145 * $days)); $this->assertEquals($this->object->formatDate(time() - 367 * $days), $this->object->timeSince(time() - 367 * $days)); }
</th> <th><?php echo TextHelper::_('COBALT_PEOPLE_CONTACT'); ?> </th> <?php $c = count($company['people']); for ($i = 0; $i < $c; $i++) { $person = $company['people'][$i]; $k = $i % 2; echo '<tr class="cobalt_row_' . $k . '">'; if (array_key_exists('avatar', $person) && $person['avatar'] != "") { echo '<td><img src="' . JURI::base() . 'src/Cobalt/media/avatars/' . $person['avatar'] . '"/></td>'; } else { echo '<td><img src="' . JURI::base() . 'src/Cobalt/media/images/person.png' . '"/></td>'; } echo '<td>' . $person['last_name'] . ', ' . $person['first_name'] . '</td>'; echo '<td>' . $person['phone'] . '</td>'; echo '<td>' . $person['owner_first_name'] . ' ' . $person['owner_last_name'] . '</td>'; echo '<td>' . ucwords($person['type']) . '</td>'; echo '<td>' . DateHelper::formatDate($person['modified']) . '</td>'; echo '</tr>'; } ?> </table> </div> </div> </div> </div>
<?php /*------------------------------------------------------------------------ # Cobalt # ------------------------------------------------------------------------ # @author Cobalt # @copyright Copyright (C) 2012 cobaltcrm.org All Rights Reserved. # @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL # Website: http://www.cobaltcrm.org -------------------------------------------------------------------------*/ // no direct access defined('_CEXEC') or die('Restricted access'); $c = count($this->notes); for ($i = 0; $i < $c; $i++) { $note = $this->notes[$i]; echo '<li>'; echo '<div class="ui-li-aside"><b>' . DateHelper::formatDate($note['created']) . '</b></div>'; echo '<h3 class="ui-li-heading"><b>' . $note['owner_first_name'] . ' ' . $note['owner_last_name'] . '</b></h3>'; echo '<p class="ui-li-desc">' . $note['note'] . '</p>'; echo '</li>'; }
" /> </div> <?php break; case "date": ?> <!-- make this a custom date picker --> <div class="input-append"> <input id="custom_<?php echo isset($value['id']) ? $value['id'] : ''; ?> " name="custom_<?php echo isset($value['id']) ? $value['id'] : ''; ?> _input" class="form-control filter_input date_input" type="text" value="<?php echo DateHelper::formatDate($custom_field_filter); ?> " /> <input id="custom_<?php echo isset($value['id']) ? $value['id'] : ''; ?> _hidden" name="custom_<?php echo isset($value['id']) ? $value['id'] : ''; ?> " type="hidden" value="<?php echo $custom_field_filter; ?> " /> <span class="input-append-addon"><i class="glyphicon glyphicon-calendar"></i></span> </div> <?php
<select class="form-control" name="category_id"> <?php $categories = NoteHelper::getCategories(); echo JHtml::_('select.options', $categories, 'value', 'text', $note['category_id'], true); ?> </select> </div> </div> <div class="cobaltRow"> <div class="cobaltField"><?php echo TextHelper::_('COBALT_CREATED_ON'); ?> </div> <div class="cobaltValue"> <span class="date"><?php echo DateHelper::formatDate($note['created']) . ' ' . DateHelper::formatTime($note['created']); ?> </span> </div> </div> <div class="cobaltRow"> <div class="cobaltField"><?php echo TextHelper::_('COBALT_CONTENT'); ?> </div> <div class="cobaltValue"> <textarea class="form-control" name="note"><?php echo $note['note']; ?> </textarea> </div>
echo RouteHelper::_('index.php?view=events&layout=edit_task'); ?> " data-icon="plus" class="ui-btn-right"> <?php echo ucwords(TextHelper::_('COBALT_ADD_TASK')); ?> </a> </div> <div data-role="content"> <ul class="ui-listview" data-role="listview" data-filter="true" data-autodividers="true" data-theme="c"> <?php $n = count($this->events); for ($i = 0; $i < $n; $i++) { $event = $this->events[$i]; $event_date = DateHelper::formatDate($event['due_date']); $k = $i % 2; if ($i == 0 || substr_compare($event['due_date'], $this->events[$i - 1]['due_date'], 0)) { echo "<li data-role='list-divider'>" . DateHelper::getRelativeDate($event_date) . " " . $event_date . "</li>"; } ?> <li data-filtertext="<?php echo $event['name']; ?> "> <a href="<?php echo RouteHelper::_('index.php?view=events&layout=event&id=' . $event['id']); ?> "> <h3 class="ui-li-heading"><?php echo $event['name'];
echo $k; ?> "> <td><a href="<?php echo RouteHelper::_('index.php?view=reports&layout=custom_report&id=' . $report['id']); ?> "><?php echo $report['name']; ?> </a></td> <td><?php echo DateHelper::formatDate($report['modified']); ?> </td> <td><?php echo DateHelper::formatDate($report['created']); ?> </td> <td> <a href="<?php echo RouteHelper::_('index.php?view=reports&layout=edit_custom_report&id=' . $report['id']); ?> "><?php echo TextHelper::_('COBALT_EDIT_BUTTON'); ?> </a> | <a href="javascript:void(0);" class="delete delete_custom_report"><i class="glyphicon glyphicon-trash"></i></a> </td> </tr> <?php
} ?> <span <?php echo $hidden; ?> class="end_date"><?php echo TextHelper::_('COBALT_END_DATE_MESSAGE'); ?> </span> <div <?php echo $show; ?> id="end_date"> <input id="end_date_input" class="form-control date_input" type="text" name="end_date_input" value="<?php if (array_key_exists('end_date', $event)) { echo DateHelper::formatDate($event['end_date']); } ?> " /> <input id="end_date_input_hidden" name="end_date" type="hidden" value="<?php if (array_key_exists('end_date', $event)) { echo $event['end_date']; } ?> " /> </div> </div> </div> <div class="cobaltRow"> <div class="cobaltField"><?php echo TextHelper::_('COBALT_EDIT_TASK_REPEAT');
if ($note['deal_id'] != null and $note['deal_id'] != 0) { echo '<a href="' . RouteHelper::_('index.php?view=deals&layout=deal&id=' . $note['deal_id']) . '">' . $note['deal_name'] . '</a>'; } ?> </td> <td> <?php if ($note['person_id'] != null and $note['person_id'] != 0) { echo '<a href="' . RouteHelper::_('index.php?view=people&layout=person&id=' . $note['person_id']) . '">' . $note['person_first_name'] . ' ' . $note['person_last_name'] . '</a>'; } ?> </td> <td><?php echo $note['owner_first_name'] . " " . $note['owner_last_name']; ?> </td> <td><?php echo DateHelper::formatDate($note['created']); ?> </td> <td><?php echo $note['category_name']; ?> </td> <td><?php echo $note['note']; ?> </td> </tr> <?php }
function affiliates_admin_hits_affiliate() { global $wpdb, $affiliates_options; $output = ''; if (!current_user_can(AFFILIATES_ACCESS_AFFILIATES)) { wp_die(__('Access denied.', AFFILIATES_PLUGIN_DOMAIN)); } if (isset($_POST['from_date']) || isset($_POST['thru_date']) || isset($_POST['clear_filters']) || isset($_POST['affiliate_id']) || isset($_POST['expanded']) || isset($_POST['expanded_hits']) || isset($_POST['expanded_referrals']) || isset($_POST['show_inoperative'])) { if (!wp_verify_nonce($_POST[AFFILIATES_ADMIN_HITS_AFF_FILTER_NONCE], 'admin')) { wp_die(__('Access denied.', AFFILIATES_PLUGIN_DOMAIN)); } } // filters $from_date = $affiliates_options->get_option('hits_affiliate_from_date', null); $thru_date = $affiliates_options->get_option('hits_affiliate_thru_date', null); $affiliate_id = $affiliates_options->get_option('hits_affiliate_affiliate_id', null); $expanded = $affiliates_options->get_option('hits_affiliate_expanded', null); // @todo input ist not shown, eventually remove unless ... $expanded_referrals = $affiliates_options->get_option('hits_affiliate_expanded_referrals', null); $expanded_hits = $affiliates_options->get_option('hits_affiliate_expanded_hits', null); $show_inoperative = $affiliates_options->get_option('hits_affiliate_show_inoperative', null); if (isset($_POST['clear_filters'])) { $affiliates_options->delete_option('hits_affiliate_from_date'); $affiliates_options->delete_option('hits_affiliate_thru_date'); $affiliates_options->delete_option('hits_affiliate_affiliate_id'); $affiliates_options->delete_option('hits_affiliate_expanded'); $affiliates_options->delete_option('hits_affiliate_expanded_referrals'); $affiliates_options->delete_option('hits_affiliate_expanded_hits'); $affiliates_options->delete_option('hits_affiliate_show_inoperative'); $from_date = null; $thru_date = null; $affiliate_id = null; $expanded = null; $expanded_hits = null; $expanded_referrals = null; $show_inoperative = null; } else { if (isset($_POST['submitted'])) { // filter by date(s) if (!empty($_POST['from_date'])) { $from_date = date('Y-m-d', strtotime($_POST['from_date'])); $affiliates_options->update_option('hits_affiliate_from_date', $from_date); } else { $from_date = null; $affiliates_options->delete_option('hits_affiliate_from_date'); } if (!empty($_POST['thru_date'])) { $thru_date = date('Y-m-d', strtotime($_POST['thru_date'])); $affiliates_options->update_option('hits_affiliate_thru_date', $thru_date); } else { $thru_date = null; $affiliates_options->delete_option('hits_affiliate_thru_date'); } if ($from_date && $thru_date) { if (strtotime($from_date) > strtotime($thru_date)) { $thru_date = null; $affiliates_options->delete_option('hits_affiliate_thru_date'); } } // filter by affiliate id if (!empty($_POST['affiliate_id'])) { $affiliate_id = affiliates_check_affiliate_id($_POST['affiliate_id']); if ($affiliate_id) { $affiliates_options->update_option('hits_affiliate_affiliate_id', $affiliate_id); } } else { if (isset($_POST['affiliate_id'])) { // empty && isset => '' => all $affiliate_id = null; $affiliates_options->delete_option('hits_affiliate_affiliate_id'); } } // expanded details? if (!empty($_POST['expanded'])) { $expanded = true; $affiliates_options->update_option('hits_affiliate_expanded', true); } else { $expanded = false; $affiliates_options->delete_option('hits_affiliate_expanded'); } if (!empty($_POST['expanded_hits'])) { $expanded_hits = true; $affiliates_options->update_option('hits_affiliate_expanded_hits', true); } else { $expanded_hits = false; $affiliates_options->delete_option('hits_affiliate_expanded_hits'); } if (!empty($_POST['expanded_referrals'])) { $expanded_referrals = true; $affiliates_options->update_option('hits_affiliate_expanded_referrals', true); } else { $expanded_referrals = false; $affiliates_options->delete_option('hits_affiliate_expanded_referrals'); } if (!empty($_POST['show_inoperative'])) { $show_inoperative = true; $affiliates_options->update_option('hits_affiliate_show_inoperative', true); } else { $show_inoperative = false; $affiliates_options->delete_option('hits_affiliate_show_inoperative'); } } } if (isset($_POST['row_count'])) { if (!wp_verify_nonce($_POST[AFFILIATES_ADMIN_HITS_AFF_NONCE_1], 'admin')) { wp_die(__('Access denied.', AFFILIATES_PLUGIN_DOMAIN)); } } if (isset($_POST['paged'])) { if (!wp_verify_nonce($_POST[AFFILIATES_ADMIN_HITS_AFF_NONCE_2], 'admin')) { wp_die(__('Access denied.', AFFILIATES_PLUGIN_DOMAIN)); } } $current_url = (is_ssl() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; $current_url = remove_query_arg('paged', $current_url); $affiliates_table = _affiliates_get_tablename('affiliates'); $referrals_table = _affiliates_get_tablename('referrals'); $hits_table = _affiliates_get_tablename('hits'); $output .= '<div>' . '<h2>' . __('Affiliates & Referrals', AFFILIATES_PLUGIN_DOMAIN) . '</h2>' . '</div>'; $row_count = isset($_POST['row_count']) ? intval($_POST['row_count']) : 0; if ($row_count <= 0) { $row_count = $affiliates_options->get_option('hits_affiliate_per_page', AFFILIATES_HITS_AFFILIATE_PER_PAGE); } else { $affiliates_options->update_option('hits_affiliate_per_page', $row_count); } $offset = isset($_GET['offset']) ? intval($_GET['offset']) : 0; if ($offset < 0) { $offset = 0; } $paged = isset($_GET['paged']) ? intval($_GET['paged']) : 0; if ($paged < 0) { $paged = 0; } $orderby = isset($_GET['orderby']) ? $_GET['orderby'] : null; switch ($orderby) { case 'date': case 'visits': case 'hits': case 'referrals': case 'ratio': case 'name': break; default: $orderby = 'name'; } $order = isset($_GET['order']) ? $_GET['order'] : null; switch ($order) { case 'asc': case 'ASC': $switch_order = 'DESC'; break; case 'desc': case 'DESC': $switch_order = 'ASC'; break; default: $order = 'ASC'; $switch_order = 'DESC'; } if ($from_date || $thru_date || $affiliate_id) { $filters = " WHERE "; } else { $filters = ''; } $filter_params = array(); // We now have the desired dates from the user's point of view, i.e. in her timezone. // If supported, adjust the dates for the site's timezone: if ($from_date) { $from_datetime = DateHelper::u2s($from_date); } if ($thru_date) { $thru_datetime = DateHelper::u2s($thru_date, 24 * 3600); } if ($from_date && $thru_date) { $filters .= " datetime >= %s AND datetime < %s "; $filter_params[] = $from_datetime; $filter_params[] = $thru_datetime; } else { if ($from_date) { $filters .= " datetime >= %s "; $filter_params[] = $from_datetime; } else { if ($thru_date) { $filters .= " datetime < %s "; $filter_params[] = $thru_datetime; } } } if ($affiliate_id) { if ($from_date || $thru_date) { $filters .= " AND "; } $filters .= " h.affiliate_id = %d "; $filter_params[] = $affiliate_id; } // how many are there ? $count_query = $wpdb->prepare("SELECT affiliate_id FROM {$hits_table} h\n\t\t{$filters}\n\t\tGROUP BY affiliate_id\n\t\t", $filter_params); $wpdb->query($count_query); $count = $wpdb->num_rows; if ($count > $row_count) { $paginate = true; } else { $paginate = false; } $pages = ceil($count / $row_count); if ($paged > $pages) { $paged = $pages; } if ($paged != 0) { $offset = ($paged - 1) * $row_count; } // Get the summarized results, these are grouped by date. // Note: Referrals on dates without a hit will not be included. // @see notes about this in affiliates_admin_hits() $date_condition = ""; if ($from_date && $thru_date) { $date_condition = " AND datetime >= '" . $from_datetime . "' AND datetime < '" . $thru_datetime . "' "; } else { if ($from_date) { $date_condition = " AND datetime >= '" . $from_datetime . "' "; } else { if ($thru_date) { $date_condition = " AND datetime < '" . $thru_datetime . "' "; } } } $query = $wpdb->prepare("\n\t\t\tSELECT\n\t\t\t\t*,\n\t\t\t\tcount(distinct ip) visits,\n\t\t\t\tsum(count) hits,\n\t\t\t\t(select count(*) from {$referrals_table} where affiliate_id = h.affiliate_id {$date_condition} ) referrals,\n\t\t\t\t((select count(*) from {$referrals_table} where affiliate_id = h.affiliate_id {$date_condition} )/count(distinct ip)) ratio\n\t\t\tFROM {$hits_table} h\n\t\t\tLEFT JOIN {$affiliates_table} a ON h.affiliate_id = a.affiliate_id\n\t\t\t{$filters}\n\t\t\tGROUP BY h.affiliate_id\n\t\t\tORDER BY {$orderby} {$order}\n\t\t\tLIMIT {$row_count} OFFSET {$offset}\n\t\t\t", $filter_params); $results = $wpdb->get_results($query, OBJECT); $column_display_names = array('name' => __('Affiliate', AFFILIATES_PLUGIN_DOMAIN), 'visits' => __('Visitors', AFFILIATES_PLUGIN_DOMAIN), 'hits' => __('Hits', AFFILIATES_PLUGIN_DOMAIN), 'referrals' => __('Referrals', AFFILIATES_PLUGIN_DOMAIN), 'ratio' => __('Ratio', AFFILIATES_PLUGIN_DOMAIN)); $output .= '<div id="" class="hits-affiliates-overview">'; $affiliates = affiliates_get_affiliates(true, !$show_inoperative); $affiliates_select = ''; if (!empty($affiliates)) { $affiliates_select .= '<label class="affiliate-id-filter" for="affiliate_id">' . __('Affiliate', AFFILIATES_PLUGIN_DOMAIN) . '</label>'; $affiliates_select .= '<select class="affiliate-id-filter" name="affiliate_id">'; $affiliates_select .= '<option value="">--</option>'; foreach ($affiliates as $affiliate) { if ($affiliate_id == $affiliate['affiliate_id']) { $selected = ' selected="selected" '; } else { $selected = ''; } $affiliates_select .= '<option ' . $selected . ' value="' . esc_attr($affiliate['affiliate_id']) . '">' . esc_attr(stripslashes($affiliate['name'])) . '</option>'; } $affiliates_select .= '</select>'; } $output .= '<div class="filters">' . '<label class="description" for="setfilters">' . __('Filters', AFFILIATES_PLUGIN_DOMAIN) . '</label>' . '<form id="setfilters" action="" method="post">' . '<p>' . $affiliates_select . '</p> <p>' . '<label class="from-date-filter" for="from_date">' . __('From', AFFILIATES_PLUGIN_DOMAIN) . '</label>' . '<input class="datefield from-date-filter" name="from_date" type="text" value="' . esc_attr($from_date) . '"/>' . '<label class="thru-date-filter" for="thru_date">' . __('Until', AFFILIATES_PLUGIN_DOMAIN) . '</label>' . '<input class="datefield thru-date-filter" name="thru_date" type="text" class="datefield" value="' . esc_attr($thru_date) . '"/>' . '</p> <p>' . wp_nonce_field('admin', AFFILIATES_ADMIN_HITS_AFF_FILTER_NONCE, true, false) . '<input class="button" type="submit" value="' . __('Apply', AFFILIATES_PLUGIN_DOMAIN) . '"/>' . '<label class="expanded-filter">' . '<input class="expanded-filter" name="expanded_referrals" type="checkbox" ' . ($expanded_referrals ? 'checked="checked"' : '') . '/>' . ' ' . __('Expand referrals', AFFILIATES_PLUGIN_DOMAIN) . '</label>' . '<label class="expanded-filter">' . '<input class="expanded-filter" name="expanded_hits" type="checkbox" ' . ($expanded_hits ? 'checked="checked"' : '') . '/>' . ' ' . __('Expand hits', AFFILIATES_PLUGIN_DOMAIN) . '</label>' . '<label class="show-inoperative-filter">' . '<input class="show-inoperative-filter" name="show_inoperative" type="checkbox" ' . ($show_inoperative ? 'checked="checked"' : '') . '/>' . ' ' . __('Include inoperative affiliates', AFFILIATES_PLUGIN_DOMAIN) . '</label>' . '<input class="button" type="submit" name="clear_filters" value="' . __('Clear', AFFILIATES_PLUGIN_DOMAIN) . '"/>' . '<input type="hidden" value="submitted" name="submitted"/>' . '</p>' . '</form>' . '</div>'; $output .= ' <div class="page-options"> <form id="setrowcount" action="" method="post"> <div> <label for="row_count">' . __('Results per page', AFFILIATES_PLUGIN_DOMAIN) . '</label>' . '<input name="row_count" type="text" size="2" value="' . esc_attr($row_count) . '" /> ' . wp_nonce_field('admin', AFFILIATES_ADMIN_HITS_AFF_NONCE_1, true, false) . ' <input class="button" type="submit" value="' . __('Apply', AFFILIATES_PLUGIN_DOMAIN) . '"/> </div> </form> </div> '; if ($paginate) { require_once AFFILIATES_CORE_LIB . '/class-affiliates-pagination.php'; $pagination = new Affiliates_Pagination($count, null, $row_count); $output .= '<form id="posts-filter" method="post" action="">'; $output .= '<div>'; $output .= wp_nonce_field('admin', AFFILIATES_ADMIN_HITS_AFF_NONCE_2, true, false); $output .= '</div>'; $output .= '<div class="tablenav top">'; $output .= $pagination->pagination('top'); $output .= '</div>'; $output .= '</form>'; } $output .= ' <table id="" class="wp-list-table widefat fixed" cellspacing="0"> <thead> <tr> '; foreach ($column_display_names as $key => $column_display_name) { $options = array('orderby' => $key, 'order' => $switch_order); $class = ""; if (strcmp($key, $orderby) == 0) { $lorder = strtolower($order); $class = "{$key} manage-column sorted {$lorder}"; } else { $class = "{$key} manage-column sortable"; } $column_display_name = '<a href="' . esc_url(add_query_arg($options, $current_url)) . '"><span>' . $column_display_name . '</span><span class="sorting-indicator"></span></a>'; $output .= "<th scope='col' class='{$class}'>{$column_display_name}</th>"; } $output .= '</tr> </thead> <tbody> '; if (count($results) > 0) { for ($i = 0; $i < count($results); $i++) { $result = $results[$i]; $output .= '<tr class=" ' . ($i % 2 == 0 ? 'even' : 'odd') . '">'; $affiliate = affiliates_get_affiliate($result->affiliate_id); $output .= "<td class='affiliate-name'>" . stripslashes(wp_filter_nohtml_kses($affiliate['name'])) . "</td>"; $output .= "<td class='visits'>{$result->visits}</td>"; $output .= "<td class='hits'>{$result->hits}</td>"; $output .= "<td class='referrals'>{$result->referrals}</td>"; $output .= "<td class='ratio'>{$result->ratio}</td>"; $output .= '</tr>'; if ($expanded || $expanded_referrals || $expanded_hits) { // // expanded : referrals ---------------------------------------- // if ($expanded_referrals) { // get the detailed results for referrals $referrals_filters = " WHERE r.affiliate_id = %d "; $referrals_filter_params = array($result->affiliate_id); if ($from_date && $thru_date) { $referrals_filters .= " AND datetime >= %s AND datetime < %s "; $referrals_filter_params[] = $from_datetime; $referrals_filter_params[] = $thru_datetime; } else { if ($from_date) { $referrals_filters .= " AND datetime >= %s "; $referrals_filter_params[] = $from_datetime; } else { if ($thru_date) { $referrals_filters .= " datetime < %s "; $referrals_filter_params[] = $thru_datetime; } } } $referrals_orderby = "datetime {$order}"; $referrals_query = $wpdb->prepare("SELECT *\n\t\t\t\t\t\tFROM {$referrals_table} r\n\t\t\t\t\t\tLEFT JOIN {$affiliates_table} a ON r.affiliate_id = a.affiliate_id\n\t\t\t\t\t\t{$referrals_filters}\n\t\t\t\t\t\tORDER BY {$referrals_orderby}\n\t\t\t\t\t\t", $referrals_filter_params); $referrals = $wpdb->get_results($referrals_query, OBJECT); if (count($referrals) > 0) { $output .= '<tr class=" ' . ($i % 2 == 0 ? 'even' : 'odd') . '">'; $output .= '<td colspan="5">'; $output .= '<div class="details-referrals">'; $output .= '<p class="description">' . __('Referrals', AFFILIATES_PLUGIN_DOMAIN) . '</p>'; $output .= ' <table id="details-referrals-' . esc_attr($result->date) . '" class="details-referrals" cellspacing="0"> <thead> <tr> <th scope="col" class="datetime">' . __('Time', AFFILIATES_PLUGIN_DOMAIN) . '</th> <th scope="col" class="post-id">' . __('Post', AFFILIATES_PLUGIN_DOMAIN) . '</th> <th scope="col" class="affiliate-id">' . __('Affiliate', AFFILIATES_PLUGIN_DOMAIN) . '</th> </tr> </thead> <tbody> '; foreach ($referrals as $referral) { $output .= '<tr class="details-referrals ' . ($i % 2 == 0 ? 'even' : 'odd') . '">'; $output .= "<td class='datetime'>" . DateHelper::s2u($referral->datetime) . "</td>"; $link = get_permalink($referral->post_id); $title = get_the_title($referral->post_id); $output .= '<td class="post-id"><a href="' . esc_attr($link) . '" target="_blank">' . stripslashes(wp_filter_nohtml_kses($title)) . '</a></td>'; $output .= "<td class='affiliate-id'>" . stripslashes(wp_filter_nohtml_kses($referral->name)) . "</td>"; $output .= '</tr>'; } $output .= '</tbody></table>'; $output .= '</div>'; // .details-referrals $output .= '</td></tr>'; } } // if $expanded_referrals // // expanded : hits ---------------------------------------- // if ($expanded_hits) { // get the detailed results for hits $details_orderby = "date {$order}, time {$order}"; $details_filters = " WHERE h.affiliate_id = %d "; $details_filter_params = array($result->affiliate_id); if ($from_date && $thru_date) { $details_filters .= " AND datetime >= %s AND datetime < %s "; $details_filter_params[] = $from_datetime; $details_filter_params[] = $thru_datetime; } else { if ($from_date) { $details_filters .= " AND datetime >= %s "; $details_filter_params[] = $from_datetime; } else { if ($thru_date) { $details_filters .= " datetime < %s "; $details_filter_params[] = $thru_datetime; } } } $details_query = $wpdb->prepare("SELECT *\n\t\t\t\t\t\tFROM {$hits_table} h\n\t\t\t\t\t\tLEFT JOIN {$affiliates_table} a ON h.affiliate_id = a.affiliate_id\n\t\t\t\t\t\t{$details_filters}\n\t\t\t\t\t\tORDER BY {$details_orderby}\n\t\t\t\t\t\t", $details_filter_params); $hits = $wpdb->get_results($details_query, OBJECT); $output .= '<tr class=" ' . ($i % 2 == 0 ? 'even' : 'odd') . '">'; $output .= '<td colspan="5">'; $output .= '<div class="details-hits">'; $output .= '<p class="description">' . __('Hits', AFFILIATES_PLUGIN_DOMAIN) . '</p>'; $output .= ' <table id="details-hits-' . esc_attr($result->date) . '" class="details-hits" cellspacing="0"> <thead> <tr> <th scope="col" class="date">' . __('Date', AFFILIATES_PLUGIN_DOMAIN) . '</th> <th scope="col" class="time">' . __('Time', AFFILIATES_PLUGIN_DOMAIN) . '</th> <th scope="col" class="ip">' . __('IP', AFFILIATES_PLUGIN_DOMAIN) . '</th> <th scope="col" class="count">' . __('Count', AFFILIATES_PLUGIN_DOMAIN) . '</th> <th scope="col" class="affiliate-id">' . __('Affiliate', AFFILIATES_PLUGIN_DOMAIN) . '</th> </tr> </thead> <tbody> '; foreach ($hits as $hit) { $output .= '<tr class="details ' . ($i % 2 == 0 ? 'even' : 'odd') . '">'; // $output .= "<td class='date'>$hit->date</td>"; $output .= '<td class="date">' . DateHelper::formatDate(DateHelper::s2u($hit->datetime)) . '</td>'; // $output .= "<td class='time'>$hit->time</td>"; $output .= '<td class="time">' . DateHelper::formatTime(DateHelper::s2u($hit->datetime)) . '</td>'; $output .= "<td class='ip'>" . long2ip($hit->ip) . "</td>"; $output .= "<td class='count'>{$hit->count}</td>"; $output .= "<td class='affiliate-id'>" . stripslashes(wp_filter_nohtml_kses($hit->name)) . "</td>"; $output .= '</tr>'; } $output .= '</tbody></table>'; $output .= '</div>'; // .details-hits $output .= '</td></tr>'; } // if $expanded_hits } // expanded } } else { $output .= '<tr><td colspan="5">' . __('There are no results.', AFFILIATES_PLUGIN_DOMAIN) . '</td></tr>'; } $output .= '</tbody>'; $output .= '</table>'; if ($paginate) { require_once AFFILIATES_CORE_LIB . '/class-affiliates-pagination.php'; $pagination = new Affiliates_Pagination($count, null, $row_count); $output .= '<div class="tablenav bottom">'; $output .= $pagination->pagination('bottom'); $output .= '</div>'; } $output .= '</div>'; // .visits-overview echo $output; affiliates_footer(); }
private function fillTOURInfo($input) { AImporter::model('tour', 'orderinfos', 'passengers'); AImporter::helper('tour', 'date', 'bookpro', 'image'); $duration = TourHelper::buildDuration($this->orderComplex->tour); $input = str_replace('{duration}', $duration, $input); $input = str_replace('{tour_name}', $this->orderComplex->tour->title, $input); $input = str_replace('{tour_number}', $this->orderComplex->tour->code, $input); $input = str_replace('{depart}', DateHelper::formatDate($this->orderComplex->tour->start), $input); if ($this->orderComplex->tour->type = "TOUR") { $customfield = BookProHelper::renderLayout('tour', $this->orderComplex->tour); $input = str_replace('{infosummary}', $customfield, $input); $layout = new JLayoutFile('addons', $basePath = JPATH_ROOT . '/components/com_bookpro/layouts'); $html = $layout->render($this->orderComplex); $input = str_replace('{addons}', $html, $input); $layout = new JLayoutFile('passengers', $basePath = JPATH_ROOT . '/components/com_bookpro/layouts'); $html = $layout->render($this->orderComplex->passengers); $input = str_replace('{passengers}', $html, $input); } elseif ($this->orderComplex->tour->type = "TOUR_INQUIRY") { $customfield = BookProHelper::renderLayout('customfieldvalue', $this->order->id); $input = str_replace('{customfields}', $customfield, $input); $customfield = BookProHelper::renderLayout('tour', $this->orderComplex); $input = str_replace('{infosummary}', $customfield, $input); } return $input; }
echo '<td>' . $person['phone'] . '</td>'; echo '<td>' . $person['owner_first_name'] . ' ' . $person['owner_last_name'] . '</td>'; echo '<td>' . ucwords($person['type']) . '</td>'; echo '<td>' . DateHelper::formatDate($person['modified']) . '</td>'; echo '</tr>'; } ?> </table> </div> <h2><?php echo TextHelper::_('COBALT_EDIT_CONVERSATIONS'); ?> </h2> <div id="conversation_entries"> <?php $c = count($deal->conversations); for ($i = 0; $i < $c; $i++) { $convo = $deal->conversations[$i]; echo '<div class="conversation">'; echo '<div class="header"><b>' . DateHelper::formatDate($convo['created']) . '</b></div>'; echo '<div class="convo_info"><b>' . TextHelper::_('COBALT_USER') . '</b> ' . TextHelper::_('COBALT_WROTE') . ':</div>'; echo '<div class="convo">' . $convo['conversation'] . '</div>'; echo '</div>'; } ?> </div> </div>
echo JURI::base(); ?> </a> </td> <td width="300" height="60" valign="top" align="right"> <p><strong><?php echo TextHelper::_('COBALT_MORNING_COFFEE_REPORT_TITLE'); ?> <?php echo $this->user->first_name . ' ' . $this->user->last_name; ?> <br><?php echo TextHelper::_('COBALT_SUMMARY_FOR'); ?> <?php echo DateHelper::formatDate(date('Y-m-d')); ?> </strong> <br> <a href="<?php echo JURI::base() . '/index.php?option=com_user&view=login'; ?> " style="color:#999999;"><?php echo TextHelper::_('COBALT_LOGIN'); ?> </a> </p> </td> </tr> <tr> <td colspan="2"> <table width="100%" border="0" cellpadding="5" cellspacing="0" style="font-family:Arial, Helvetica, sans-serif; font-size:11px;"> <tr>
# @author Cobalt # @copyright Copyright (C) 2012 cobaltcrm.org All Rights Reserved. # @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL # Website: http://www.cobaltcrm.org -------------------------------------------------------------------------*/ // no direct access defined('_CEXEC') or die('Restricted access'); $events = $this->info; if (count($events) > 0) { foreach ($events as $event) { echo '<div class="com_cobalt_task_event">'; $display_date = $event['type'] == "event" ? $event['start_time'] : $event['due_date']; if ($display_date == "") { $display_date = TextHelper::_('COBALT_NA'); } echo '<div class="date">' . DateHelper::formatDate($display_date) . '</div>'; if ($event['completed'] == 1) { $completed = "line-through"; } else { $completed = ""; } echo '<span class="' . $completed . '" >'; echo '<b>' . $event['name'] . '</b>'; echo '</a>'; switch ($event['association_type']) { case "company": echo "<div class='task_association'>(" . $event['company_name'] . ")</div>"; break; case "deal": echo "<div class='task_association'>(" . $event['deal_name'] . ")</div>"; break;
<div class="cobaltValue"> <?php echo ucwords($person['type']); ?> </div> </div> </div> <div class="threecolumn"> <div class="small_info last"> <?php echo TextHelper::_('COBALT_PERSON_CONTACTED'); ?> : <?php echo DateHelper::formatDate($person['modified']); ?> </div> <div class="cobaltRow top"> <div class="cobaltField"><?php echo TextHelper::_('COBALT_STATUS'); ?> :</div> <div class="cobaltValue"><?php echo $person['status_name']; ?> </div> </div> <div class="cobaltRow"> <div class="cobaltField"><?php echo TextHelper::_('COBALT_SOURCE');
?> "></div></td> </tr> <?php for ($i2 = 0; $i2 < count($deal->events); $i2++) { $event = $deal->events[$i2]; ?> <tr> <td><?php echo $event['name']; ?> </td> <td><?php echo DateHelper::formatDate($event['due_date']); ?> </td> <td><?php echo DateHelper::formatDate($event['actual_close']); ?> </td> <td></td> </tr> <?php } ?> </tbody> </table> </div> </div> <?php }
<li><a href="javascript:void(0)" class="person_type_select dropdown_item" data-field="type" data-item="people" data-item-id="<?php echo $person['id']; ?> " data-value="<?php echo ucwords($id); ?> "> <?php echo ucwords($name); ?> </a> </li> <?php } } ?> </ul> </div> </td> <td class="notes"><a rel="tooltip" title="<?php echo TextHelper::_('COBALT_VIEW_NOTES'); ?> " data-placement="bottom" class="btn" href="javascript:void(0);" onclick="Calendar.openNoteModal(<?php echo $person['id']; ?> , 'people');"><i class="glyphicon glyphicon-file"></i></a> <?php echo '<td class="address">' . $person['work_city'] . '<br>' . $person['work_state'] . '<br>' . $person['work_zip'] . '<br>' . $person['work_country'] . '</td>'; echo '<td class="added">' . DateHelper::formatDate($person['created']) . '</td>'; echo '<td class="updated">' . DateHelper::formatDate($person['modified']) . '</td>'; echo "</tr>";
$k = $count % 3; switch ($value['type']) { case "forecast": $custom_field_filter = array_key_exists('forecast', $this->item) ? $this->item['forecast'] : 0; break; case "text": $custom_field_filter = array_key_exists('selected', $value) ? $value['selected'] : ""; break; case "number": $custom_field_filter = array_key_exists('selected', $value) ? $value['selected'] : ""; break; case "currency": $custom_field_filter = array_key_exists('selected', $value) ? $value['selected'] : ""; break; case "date": $custom_field_filter = array_key_exists('selected', $value) && $value['selected'] != 0 && $value['selected'] != "0000-00-00 00:00:00" ? DateHelper::formatDate($value['selected']) : ""; break; case "picklist": $custom_field_filter = is_array($value) && array_key_exists('values', $value) && is_array($value['values']) && array_key_exists('selected', $value) && array_key_exists($value['selected'], $value['values']) ? $value['values'][$value['selected']] : ""; break; } echo '<tr>'; echo '<th class="customFieldHead">' . $value['name'] . '</th>'; echo '<td>'; //determine type of input switch ($value['type']) { case "text": case "number": case "currency": case "picklist": case "date":
<div id="expected_close_container"<?php if ($actual_close) { echo $style; } ?> > <?php echo TextHelper::_('COBALT_EXP_CLOSE'); ?> <h2> <form action="<?php echo RouteHelper::_('index.php'); ?> " method="post" role="form" class="inline-form" id="expected_close_form" name="expected_close_form" onsubmit="return Cobalt.sumbitForm(this)"> <input type="text" class="input-invisible editable-modal-datepicker input-small form-control date_input" name="expected_close_hidden" id="expected_close" value="<?php echo DateHelper::formatDate($deal->expected_close); ?> " /> <input type="hidden" name="expected_close" id="expected_close_hidden" value="<?php echo $deal->expected_close; ?> " /> <input type="hidden" name="task" value="save" /> <input type="hidden" name="model" value="deal" /> <input type="hidden" name="id" value="<?php echo $deal->id; ?> " /> </form> </h2> </div>
/*------------------------------------------------------------------------ # Cobalt # ------------------------------------------------------------------------ # @author Cobalt # @copyright Copyright (C) 2012 cobaltcrm.org All Rights Reserved. # @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL # Website: http://www.cobaltcrm.org -------------------------------------------------------------------------*/ // no direct access defined('_CEXEC') or die('Restricted access'); $current_heading = ""; if (count($this->events) > 0) { foreach ($this->events as $event) { $display_date = $event['type'] == "event" ? $event['start_time'] . " " . $event['start_time_hour'] : $event['due_date'] . " " . $event['due_date_hour']; $time = $event['type'] == "event" ? $event['start_time_hour'] : $event['due_date_hour']; $display_date = $display_date == "" ? TextHelper::_('COBALT_NA') : DateHelper::formatDate($display_date, false, false); $relative_date_title = DateHelper::getRelativeDate($display_date); if ($event['completed'] == 1) { $completed = "line-through"; } else { $completed = ""; } if ($current_heading != $relative_date_title) { if ($current_heading != "") { echo '</table>'; } echo '<h4>' . $relative_date_title . '</h4>'; $current_heading = $relative_date_title; echo '<table class="table table-striped table-hover">'; } echo '<tr class="com_crmery_task_event" id="com_crmery_listing_' . $event['id'] . '">';
if (stripos($activity->field, '_id') !== false) { $old_field_value = $activity->type . '_' . str_replace('_id', '_name_old', $activity->field); $old_value = isset($activity->{$old_field_value}) ? $activity->{$old_field_value} : ""; if ($old_value == "") { $old_value = TextHelper::_('COBALT_NOTHING'); } $new_field_value = $activity->type . '_' . str_replace('_id', '_name', $activity->field); $new_value = isset($activity->{$new_field_value}) ? $activity->{$new_field_value} : ""; } else { $old_value = $activity->old_value; $new_value = $activity->new_value; } $dates = array('due_date', 'modified'); if (in_array($activity->field, $dates)) { $old_value = DateHelper::formatDate($activity->old_value, true); $new_value = DateHelper::formatDate($activity->new_value, true); } ?> <?php if ($new_value != "") { ?> <tr class="crmery_row_<?php echo $k; ?> "> <td><?php echo $link . $name; ?> </a></td> <td><?php echo JText::sprintf('COBALT_ACTIVITY_' . strtoupper($activity->action_type), ucwords(str_replace('_', ' ', $activity->type)), ucwords(str_replace(' id', '', str_replace(' 1', '', str_replace('_', ' ', $activity->field)))), $old_value, $new_value);
} ?> </ul> </div> </div> <div class="clear"></div> </div> </div> <div class="col-md-4"> <div class="well well-small text-center"> <?php echo TextHelper::_('COBALT_PERSON_CONTACTED'); ?> <?php echo "<h2>" . DateHelper::formatDate($person['modified']) . "</h2>"; ?> </div> <div class="crmeryRow top"> <div class="crmeryField"><?php echo TextHelper::_('COBALT_STATUS'); ?> :</div> <div class="crmeryValue"> <?php $person['status_name'] = $person['status_name'] == '' ? TextHelper::_('COBALT_NO_STATUS') : $person['status_name']; ?> <div class="dropdown" data-item="people" data-field="status_id" data-item-id="<?php echo $person['id']; ?> " id="person_status_<?php
?> %</td> <td><div class="deal-status-<?php echo strtolower($report->status_name); ?> "></div></td> <td><?php echo DateHelper::formatDate($report->expected_close); ?> </td> <td><?php echo DateHelper::formatDate($report->modified); ?> </td> <td><?php echo DateHelper::formatDate($report->created); ?> </td> </tr> <?php } $filtered_amount = 0; if (count($this->reports) > 0) { foreach ($this->reports as $key => $report) { $filtered_amount += $report->amount; } } ?> <script type="text/javascript"> var amount = <?php echo $filtered_amount;
echo $goal['id']; ?> " class="goal_info well"> <div class="clearfix"> <span class="goal_info_name"><a href="<?php echo RouteHelper::_('index.php?view=goals&layout=edit&type=' . $goal['goal_type'] . '&tmpl=component&format=raw&id=' . $goal['id']); ?> " data-toggle="modal" data-target="#editModal"><?php echo $goal['name']; ?> </a></span> <span class="goal_info_due_date pull-right"><?php echo TextHelper::_('COBALT_BY'); ?> <?php echo DateHelper::formatDate($goal['end_date']); ?> </span> </div> <div class="goal_info_progress progress progress-success clearfix"> <?php $bgcolor = CobaltHelper::percent2Color($goal['goal_info'] / $goal['amount'] * 100); ?> <div class="goal_info_progress_total bar" style="background-color:#<?php echo $bgcolor; ?> ;width:<?php echo number_format($goal['goal_info'] / $goal['amount'] * 100); ?> %;"></div> </div>
?> : <span class="text-success"><?php echo ConfigHelper::getCurrency(); echo $company['won_deals']; ?> </span> </div> <div class="col-md-4 well well-small"> <?php echo ucwords(TextHelper::_('COBALT_COMPANY_CONTACTED')); ?> : <?php echo DateHelper::formatDate($company['modified']); ?> </div> </div> <!-- NOTES --> <?php echo $company['notes']->render(); ?> <!-- CUSTOM FIELDS --> <h3><?php echo TextHelper::_('COBALT_EDIT_CUSTOM'); ?> </h3> <div class="columncontainer">
?> </td> <td style="text-align: center;"><?php echo $subject->adult; ?> </td> <td style="text-align: center;"><?php echo $subject->child; ?> </td> <td style="text-align: center;"><?php echo $subject->price; ?> </td> <td style="text-align: center;"><?php echo $subject->start ? DateHelper::formatDate($subject->start) : 'N/A'; ?> </td> <td><?php echo $flightObj->bus_name; ?> </td> <td><?php echo $subject->location; ?> </td> </tr> <?php } } ?>
# @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL # Website: http://www.cobaltcrm.org -------------------------------------------------------------------------*/ // no direct access defined('_CEXEC') or die('Restricted access'); $app = JFactory::getApplication(); if ($app->input->get('loc')) { $model = new CobaltModelEvent(); $events = $model->getEvents($app->input->get('loc'), null, $app->input->get($app->input->get('loc') . '_id')); $this->events = $events; } if (count($this->events) > 0) { foreach ($this->events as $event) { echo '<li>'; echo "<a href='" . RouteHelper::_('index.php?view=events&id=' . $event['id']) . "'>"; echo '<span class="ui-li-count">' . DateHelper::formatDate($event['due_date']) . '</span>'; if ($event['completed'] == 1) { $completed = "line-through"; } else { $completed = ""; } echo "<h3 class='ui-li-heading'>" . $event['name'] . "</h3>"; switch ($event['association_type']) { case "company": echo "<div class='ui-li-desc'>(" . $event['company_name'] . ")</div>"; break; case "deal": echo "<div class='ui-li-desc'>(" . $event['deal_name'] . ")</div>"; break; case "person": echo "<div class='ui-li-desc'>(" . $event['person_first_name'] . " " . $event['person_last_name'] . ")</div>";