当前位置: 首页>>代码示例>>PHP>>正文


PHP waContact::getPhotoUrl方法代码示例

本文整理汇总了PHP中waContact::getPhotoUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP waContact::getPhotoUrl方法的具体用法?PHP waContact::getPhotoUrl怎么用?PHP waContact::getPhotoUrl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在waContact的用法示例。


在下文中一共展示了waContact::getPhotoUrl方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

 public function execute()
 {
     $this->setLayout(new guestbook2BackendLayout());
     // Создаем экземпляр модели для получения данных из БД
     $model = new guestbook2Model();
     // Получаем все записи гостевой книги из БД
     $records = $model->getRecords(0, 0);
     foreach ($records as &$r) {
         if ($r['contact_id']) {
             $r['name'] = $r['contact_name'];
             // получаем URL на фотографию контакта
             $r['photo_url'] = waContact::getPhotoUrl($r['contact_id'], $r['photo'], 20);
         }
     }
     unset($r);
     // Передаем записи в шаблон
     $this->view->assign('records', $records);
     // Передаём в шаблон УРЛ фронтенда
     $this->view->assign('url', wa()->getRouteUrl($this->getAppId(), true));
     // Передаём в шаблон права пользователя на удаление записей из гостевой книги
     // Права описаны в конфиге lib/config/guestbookRightConfig.class.php
     $this->view->assign('rights_delete', $this->getRights('delete'));
     // Если пользователь админ приложения контакты, то показывать ссылки на контакты
     $this->view->assign('rights_contacts', $this->getUser()->isAdmin('contacts'));
 }
开发者ID:nowaym,项目名称:webasyst-framework,代码行数:25,代码来源:guestbook2Backend.action.php

示例2: settingsAction

 public function settingsAction($params)
 {
     $blog_id = $params['id'];
     $html = '<div class="fields-group">
     <div class="field">
         <div class="name">' . _wp('Subscribed via email') . '</div>
         <div class="value">';
     $model = new blogEmailsubscriptionModel();
     $contacts = $model->getSubscribers($blog_id);
     $rights = wa()->getUser()->getRights('contacts');
     $html .= '<ul class="menu-v">';
     if (!$contacts) {
         $html .= '<li>' . _wp('none') . '</li>';
     }
     foreach ($contacts as $c) {
         $html .= '<li>';
         if ($rights) {
             $html .= '<a href="' . wa()->getConfig()->getBackendUrl(true) . 'contacts/#/contact/' . $c['id'] . '">';
         }
         $html .= '<i class="icon16 userpic20" style="background-image: url(' . waContact::getPhotoUrl($c['id'], $c['photo'], 20) . ')"></i>';
         $html .= '<span>' . htmlspecialchars($c['name']) . '</span>';
         if ($rights) {
             $html .= '</a>';
         }
         $html .= '</li>';
     }
     $html .= '</ul></div></div></div>';
     return array('settings' => $html);
 }
开发者ID:nowaym,项目名称:webasyst-framework,代码行数:29,代码来源:blogEmailsubscriptionPlugin.class.php

示例3: execute

 public function execute()
 {
     // Setting the frontend layout
     // Задаём лайаут для фронтенда
     $this->setLayout(new guestbook2FrontendLayout());
     // Setting the theme template
     // Задаём шаблон темы
     $this->setThemeTemplate('guestbook.html');
     // if a POST request has been received then write a new record to the database
     // Если пришёл POST-запрос, то нужно записать в БД новую запись
     if (waRequest::method() == 'post') {
         $this->add();
     }
     // Creating a model instance for retrieving data from the database
     // Создаем экземпляр модели для получения данных из БД
     $model = new guestbook2Model();
     // Retrieving the record count per page from the app's settings
     // Получаем количество записей на одной странице из настроек приложения
     $limit = $this->getConfig()->getOption('records_per_page');
     // Current page
     // Текущая страница
     $page = waRequest::param('page');
     if (!$page) {
         $page = 1;
     }
     $this->view->assign('page', $page);
     // Calculating offset
     // Вычисляем смещение
     $offset = ($page - 1) * $limit;
     // Retrieving all records from the database
     // Получаем записи гостевой книги из БД
     $records = $model->getRecords($offset, $limit);
     // Total record count
     // Всего записей
     $records_count = $model->countAll();
     $pages_count = ceil($records_count / $limit);
     $this->view->assign('pages_count', $pages_count);
     // Preparing records for being passed to the theme template
     // Подготавливаем записи для передачи в шаблон темы
     foreach ($records as &$r) {
         if ($r['contact_id']) {
             $r['name'] = htmlspecialchars($r['contact_name']);
             // getting contact photo URL
             // получаем URL на фотографию контакта
             $r['photo_url'] = waContact::getPhotoUrl($r['contact_id'], $r['photo'], 20);
         } else {
             $r['name'] = htmlspecialchars($r['name']);
         }
         $r['text'] = nl2br(htmlspecialchars($r['text']));
     }
     unset($r);
     // Passing records to the template
     // Передаем записи в шаблон
     $this->view->assign('records', $records);
     // URL portion for links to pages
     // Часть урла для ссылок на страницы
     $this->view->assign('url', wa()->getRouteUrl('/frontend'));
 }
开发者ID:cjmaximal,项目名称:webasyst-framework,代码行数:58,代码来源:guestbook2Frontend.action.php

示例4: getVotedUsers

 public function getVotedUsers($photo_id)
 {
     $photo_id = (int) $photo_id;
     $sql = "SELECT v.rate, v.datetime, c.name, c.photo, c.id \n                FROM `{$this->table}` v \n                JOIN `wa_contact` c ON v.contact_id = c.id\n                WHERE v.photo_id = {$photo_id} ORDER BY v.datetime DESC";
     $users = $this->query($sql)->fetchAll('id');
     $contacts_url = wa()->getAppUrl('contacts');
     foreach ($users as &$u) {
         $u['photo'] = waContact::getPhotoUrl($u['id'], $u['photo'], 20, 20);
         $u['url'] = $contacts_url . '#/contact/' . $u['id'] . '/';
     }
     unset($u);
     return $users;
 }
开发者ID:cjmaximal,项目名称:webasyst-framework,代码行数:13,代码来源:photosPublicgalleryVote.model.php

示例5: commentsPrepare

 public function commentsPrepare(&$comments)
 {
     $default = $this->getSettingValue('default');
     if ($default == 'custom') {
         $default = wa()->getConfig()->getHostUrl() . waContact::getPhotoUrl(0, false, 20);
     }
     foreach ($comments as &$comment) {
         if (isset($comment['user']) && !$comment['contact_id'] && (!$comment['auth_provider'] || $comment['auth_provider'] == blogCommentModel::AUTH_GUEST) && $comment['email']) {
             $md5 = md5(strtolower($comment['email']));
             $comment['user']['photo_url'] = $comment['user']['photo_url_20'] = "//www.gravatar.com/avatar/{$md5}?size=20&amp;default={$default}";
             unset($data);
         }
         unset($comment);
     }
 }
开发者ID:cjmaximal,项目名称:webasyst-framework,代码行数:15,代码来源:blogGravatar.plugin.php

示例6: commentsPrepare

 public function commentsPrepare(&$comments)
 {
     $default = $this->getSettingValue('default');
     if ($default == 'custom') {
         $default = wa()->getConfig()->getHostUrl() . waContact::getPhotoUrl(0, false, 20);
     }
     $scheme = parse_url(wa()->getRootUrl(true), PHP_URL_SCHEME);
     foreach ($comments as &$comment) {
         if (isset($comment['user']) && !$comment['contact_id'] && (!$comment['auth_provider'] || $comment['auth_provider'] == blogCommentModel::AUTH_GUEST) && $comment['email']) {
             $md5 = md5(strtolower($comment['email']));
             $comment['user']['photo_url'] = "http://www.gravatar.com/avatar/{$md5}?size=20&amp;default={$default}";
             foreach ($comment['user'] as $field => &$data) {
                 if (preg_match('/^photo_url_([\\d]+)$/', $field, $matches)) {
                     $data = "{$scheme}://www.gravatar.com/avatar/{$md5}?size={$matches[1]}&amp;default={$default}";
                 }
             }
             unset($data);
         }
         unset($comment);
     }
 }
开发者ID:navi8602,项目名称:wa-shop-ppg,代码行数:21,代码来源:blogGravatar.plugin.php

示例7: getContacts

 /**
  * Get data for contacts in this collection.
  * @param string|array $fields
  * @param int $offset
  * @param int $limit
  * @return array [contact_id][field] = field value in appropriate field format
  * @throws waException
  */
 public function getContacts($fields = "id", $offset = 0, $limit = 50)
 {
     $sql = "SELECT " . $this->getFields($fields) . " " . $this->getSQL();
     $sql .= $this->getGroupBy();
     $sql .= $this->getHaving();
     $sql .= $this->getOrderBy();
     $sql .= " LIMIT " . ($offset ? $offset . ',' : '') . (int) $limit;
     //header("X-SQL-". mt_rand() . ": ". str_replace("\n", " ", $sql));
     $data = $this->getModel()->query($sql)->fetchAll('id');
     $ids = array_keys($data);
     //
     // Load fields from other storages
     //
     if ($ids && $this->post_fields) {
         // $fill[table][field] = null
         // needed for all rows to always contain all apropriate keys
         // in case when we're asked to load all fields from that table
         $fill = array_fill_keys(array_keys($this->post_fields), array());
         foreach (waContactFields::getAll('enabled') as $fid => $field) {
             /**
              * @var waContactField $field
              */
             $fill[$field->getStorage(true)][$fid] = false;
         }
         foreach ($this->post_fields as $table => $fields) {
             if ($table == '_internal') {
                 foreach ($fields as $f) {
                     /**
                      * @var $f string
                      */
                     if ($f == 'photo_url' || substr($f, 0, 10) == 'photo_url_') {
                         if ($f == 'photo_url') {
                             $size = null;
                         } else {
                             $size = substr($f, 10);
                         }
                         $retina = isset($this->options['photo_url_2x']) ? $this->options['photo_url_2x'] : null;
                         foreach ($data as $id => &$v) {
                             $v[$f] = waContact::getPhotoUrl($id, $v['photo'], $size, $size, $v['is_company'] ? 'company' : 'person', $retina);
                         }
                         unset($v);
                     } else {
                         switch ($f) {
                             case '_online_status':
                                 $llm = new waLoginLogModel();
                                 $contact_ids_map = $llm->select('DISTINCT contact_id')->where('datetime_out IS NULL')->fetchAll('contact_id');
                                 $timeout = waUser::getOption('online_timeout');
                                 foreach ($data as &$v) {
                                     if (isset($v['last_datetime']) && $v['last_datetime'] && $v['last_datetime'] != '0000-00-00 00:00:00') {
                                         if (time() - strtotime($v['last_datetime']) < $timeout) {
                                             if (isset($contact_ids_map[$v['id']])) {
                                                 $v['_online_status'] = 'online';
                                             } else {
                                                 $v['_online_status'] = 'offline';
                                             }
                                         }
                                     }
                                     $v['_online_status'] = 'offline';
                                 }
                                 unset($v);
                                 break;
                             case '_access':
                                 $rm = new waContactRightsModel();
                                 $accessStatus = $rm->getAccessStatus($ids);
                                 foreach ($data as $id => &$v) {
                                     if (!isset($accessStatus[$id])) {
                                         $v['_access'] = '';
                                         continue;
                                     }
                                     $v['_access'] = $accessStatus[$id];
                                 }
                                 unset($v);
                                 break;
                             default:
                                 throw new waException('Unknown internal field: ' . $f);
                         }
                     }
                 }
                 continue;
             }
             $data_fields = $fields;
             foreach ($data_fields as $k => $field_id) {
                 $f = waContactFields::get($field_id);
                 if ($f && $f instanceof waContactCompositeField) {
                     unset($data_fields[$k]);
                     $data_fields = array_merge($data_fields, $f->getField());
                 }
             }
             $model = $this->getModel($table);
             $post_data = $model->getData($ids, $data_fields);
             foreach ($post_data as $contact_id => $contact_data) {
                 foreach ($contact_data as $field_id => $value) {
//.........这里部分代码省略.........
开发者ID:Lazary,项目名称:webasyst,代码行数:101,代码来源:waContactsCollection.class.php

示例8: execute

 public function execute()
 {
     $category_id = waRequest::request('category', 0, 'int');
     $search = waRequest::request('search');
     $start = waRequest::request('start', 0, 'int');
     $limit = 50;
     $order = waRequest::request('order', '!last_order');
     $config = $this->getConfig();
     $use_gravatar = $config->getGeneralSettings('use_gravatar');
     $gravatar_default = $config->getGeneralSettings('gravatar_default');
     // Get customers
     $scm = new shopCustomerModel();
     list($customers, $total) = $scm->getList($category_id, $search, $start, $limit, $order);
     $has_more = $start + count($customers) < $total;
     $countries = array();
     foreach ($customers as &$c) {
         $c['affiliate_bonus'] = (double) $c['affiliate_bonus'];
         if (!$c['photo'] && $use_gravatar) {
             $c['photo'] = shopHelper::getGravatar(!empty($c['email']) ? $c['email'] : '', 50, $gravatar_default);
         } else {
             $c['photo'] = waContact::getPhotoUrl($c['id'], $c['photo'], 50, 50);
         }
         $c['categories'] = array();
         if (!empty($c['address']['region']) && !empty($c['address']['country'])) {
             $countries[$c['address']['country']] = array();
         }
     }
     unset($c);
     // Add region names to addresses
     if ($countries) {
         $rm = new waRegionModel();
         foreach ($rm->where('country_iso3 IN (?)', array_keys($countries))->query() as $row) {
             $countries[$row['country_iso3']][$row['code']] = $row['name'];
         }
         foreach ($customers as &$c) {
             if (!empty($c['address']['region']) && !empty($c['address']['country'])) {
                 $country = $c['address']['country'];
                 $region = $c['address']['region'];
                 if (!empty($countries[$country]) && !empty($countries[$country][$region])) {
                     $c['address']['region_formatted'] = $countries[$country][$region];
                 }
             }
         }
         unset($c);
     }
     // Contact categories
     $ccm = new waContactCategoryModel();
     $categories = $ccm->getAll('id');
     if ($customers) {
         $ccsm = new waContactCategoriesModel();
         foreach ($ccsm->getContactsCategories(array_keys($customers)) as $c_id => $list) {
             foreach ($list as $cat_id) {
                 if (!empty($categories[$cat_id])) {
                     $customers[$c_id]['categories'][$cat_id] = $categories[$cat_id];
                 }
             }
         }
     }
     // Set up lazy loading
     if (!$has_more) {
         // Do not trigger lazy loading, show total count at end of list
         $total_customers_number = $start + count($customers);
     } else {
         $total_customers_number = null;
         // trigger lazy loading
     }
     // List title and other params depending on list type
     if ($search) {
         $title = _w('Search results');
         $hash_start = '#/search/0/' . urlencode($search) . '/';
         $discount = null;
     } else {
         if ($category_id) {
             if (!empty($categories[$category_id])) {
                 $title = $categories[$category_id]['name'];
             } else {
                 $title = _w('Unknown category') . ' ' . $category_id;
             }
             $hash_start = '#/category/' . $category_id . '/';
             if (wa()->getSetting('discount_category')) {
                 $ccdm = new shopContactCategoryDiscountModel();
                 $discount = sprintf_wp('%s%% discount', $ccdm->getDiscount($category_id));
             } else {
                 $discount = null;
             }
         } else {
             $title = _w('All customers');
             $hash_start = '#/all/0/';
             $discount = null;
         }
     }
     $lazy_loading_params = array('limit=' . $limit, 'start=' . ($start + $limit), 'order=' . $order);
     if ($search) {
         $lazy_loading_params[] = 'search=' . $search;
     } else {
         if ($category_id) {
             $lazy_loading_params[] = 'category=' . $category_id;
         }
     }
     $lazy_loading_params = implode('&', $lazy_loading_params);
//.........这里部分代码省略.........
开发者ID:Lazary,项目名称:webasyst,代码行数:101,代码来源:shopCustomersList.action.php

示例9: getLogs

 public function getLogs($filters = array(), &$count = null)
 {
     $log_model = new waLogModel();
     $apps = wa()->getUser()->getApps();
     if (!isset($filters['app_id']) || !is_array($filters['app_id'])) {
         $user_filter = wa()->getUser()->getSettings('webasyst', 'dashboard_activity');
         if ($user_filter) {
             $filters['app_id'] = explode(',', $user_filter);
         }
     }
     if (!$this->getUser()->isAdmin()) {
         if (!empty($filters['app_id'])) {
             $filters['app_id'] = array_keys(array_intersect_key(array_flip($filters['app_id']), $apps));
         } else {
             $filters['app_id'] = array_keys($apps);
         }
     }
     $rows = $log_model->getLogs($filters);
     $count = count($rows);
     $apps = wa()->getApps(true);
     $apps_rows = array();
     $prev = array();
     foreach ($rows as $row_id => &$row) {
         if ($prev) {
             $flag = true;
             foreach (array('app_id', 'action', 'contact_id', 'subject_contact_id', 'params') as $k) {
                 if ($prev[$k] != $row[$k]) {
                     $flag = false;
                     break;
                 }
             }
             if ($flag) {
                 unset($rows[$row_id]);
                 continue;
             }
         }
         $contact_name = waContactNameField::formatName($row);
         if ($contact_name) {
             $row['contact_name'] = $contact_name;
         }
         if ($row['is_user']) {
             $row['contact_photo_url'] = waContact::getPhotoUrl($row['contact_id'], $row['contact_photo'], 32, 32);
         }
         $row['datetime_group'] = $this->getDatetimeGroup($row['datetime']);
         if (!empty($apps[$row['app_id']])) {
             $row['app'] = $apps[$row['app_id']];
             $logs = wa($row['app_id'])->getConfig()->getLogActions(true);
             $row['action_name'] = ifset($logs[$row['action']]['name'], $row['action']);
             if (strpos($row['action'], 'del')) {
                 $row['type'] = 4;
             } elseif (strpos($row['action'], 'add')) {
                 $row['type'] = 3;
             } else {
                 $row['type'] = 1;
             }
             $apps_rows[$row['app_id']][$row_id] = $row;
         } else {
             $row['app'] = array('name' => $row['app_id']);
             $row['action_name'] = $row['action'];
             $row['type'] = 1;
         }
         $prev = $row;
         unset($row);
     }
     foreach ($apps_rows as $app_id => $app_rows) {
         $app_rows = wa($app_id)->getConfig()->explainLogs($app_rows);
         foreach ($app_rows as $row_id => $row) {
             if ($row) {
                 $rows[$row_id] = $row;
             } else {
                 unset($rows[$row_id]);
             }
         }
     }
     return $rows;
 }
开发者ID:cjmaximal,项目名称:webasyst-framework,代码行数:76,代码来源:webasystDashboardActivity.action.php

示例10: get

 /** Get all history for current user, or a single history record
  * @param int $id (defaults to null) id of a record to fetch
  * @return array if $id is specified, then null (if not found) or a single array with keys: id, type, name, hash, contact_id, position, accessed, cnt; if no $id, then a list of such arrays is returned. */
 public function get($id = null)
 {
     if ($id) {
         $sql = "SELECT * FROM {$this->table} WHERE id=i:id";
         return $this->query($sql, array('id' => $id))->fetchRow();
     }
     $currentUserId = wa()->getUser()->getId();
     $sql = "SELECT *\n                FROM {$this->table}\n                WHERE contact_id=:uid\n                ORDER BY position, accessed DESC";
     $history = $this->query($sql, array('uid' => $currentUserId))->fetchAll();
     $contact_ids = array();
     foreach ($history as $h) {
         if ($h['type'] === 'add') {
             $contact_id = (int) str_replace('/contact/', '', $h['hash']);
             if ($contact_id) {
                 $contact_ids[] = $contact_id;
             }
         }
     }
     $contacts = array();
     if ($contact_ids) {
         $col = new contactsCollection('id/' . implode(',', $contact_ids));
         $contacts = $col->getContacts('id,is_company,photo_url_20');
     }
     foreach ($history as &$h) {
         if ($h['type'] === 'add') {
             $contact_id = (int) str_replace('/contact/', '', $h['hash']);
             $contact = ifset($contacts[$contact_id], array('is_company' => 0, 'photo_url_20' => waContact::getPhotoUrl(null, null, 20, 20, 'person')));
             $h['icon'] = $contact['photo_url_20'];
         }
     }
     unset($h);
     // leave only NUM_HISTORY_SHOW temporary items (i.e. position == 0 and type != import)
     $ra_limit = self::NUM_HISTORY_SHOW;
     // recently added
     $s_limit = self::NUM_HISTORY_SHOW;
     // search history
     $not_shown = array();
     foreach ($history as $k => $v) {
         if ($v['position'] > 0) {
             break;
         }
         if ($v['type'] != 'search') {
             if ($ra_limit <= 0) {
                 $not_shown[] = $v['id'];
                 unset($history[$k]);
                 continue;
             }
             $ra_limit--;
         } else {
             if ($s_limit <= 0) {
                 $not_shown[] = $v['id'];
                 unset($history[$k]);
                 continue;
             }
             $s_limit--;
         }
     }
     if ($not_shown) {
         $sql = "DELETE FROM {$this->table} WHERE id IN (i:id)";
         $this->exec($sql, array('id' => $not_shown));
         // reset holes in key sequence
         $history = array_merge($history);
     }
     return $history;
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:68,代码来源:contactsHistory.model.php

示例11: extendContacts

 protected function extendContacts(&$orders)
 {
     $config = $this->getConfig();
     $use_gravatar = $config->getGeneralSettings('use_gravatar');
     $gravatar_default = $config->getGeneralSettings('gravatar_default');
     $emails = array();
     foreach ($orders as &$o) {
         if (isset($o['contact'])) {
             if (!$o['contact']['photo'] && $use_gravatar) {
                 if (!isset($emails[$o['contact']['id']])) {
                     $c = new waContact($o['contact']['id']);
                     $emails[$o['contact']['id']] = $c->get('email', 'default');
                 }
                 $email = $emails[$o['contact']['id']];
                 $o['contact']['photo_50x50'] = shopHelper::getGravatar($email, 50, $gravatar_default);
             } else {
                 $o['contact']['photo_50x50'] = waContact::getPhotoUrl($o['contact']['id'], $o['contact']['photo'], 50, 50);
             }
         } else {
             // contact deleted
             $o['contact']['name'] = isset($o['params']['contact_name']) ? $o['params']['contact_name'] : '';
             $o['contact']['name'] = htmlspecialchars($o['contact']['name']);
             $o['contact']['email'] = isset($o['params']['contact_email']) ? $o['params']['contact_email'] : '';
             $o['contact']['phone'] = isset($o['params']['contact_phone']) ? $o['params']['contact_phone'] : '';
             if ($use_gravatar) {
                 $o['contact']['photo_50x50'] = shopHelper::getGravatar($o['contact']['email'], 50, $gravatar_default);
             } else {
                 $o['contact']['photo_50x50'] = waContact::getPhotoUrl(null, null, 50, 50);
             }
         }
     }
     unset($o);
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:33,代码来源:shopOrderListAction.class.php


注:本文中的waContact::getPhotoUrl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。