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


PHP CRM_Utils_String::append方法代码示例

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


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

示例1: date

 /**
  * function to get the complete information for one or more events
  *
  * @param  date    $start    get events with start date >= this date
  * @param  integer $type     get events on the a specific event type (by event_type_id) 
  * @param  integer $eventId  return a single event - by event id 
  * @param  date    $end      also get events with end date >= this date
  *
  * @return  array  $all      array of all the events that are searched
  * @static
  * @access public
  */
 static function &getCompleteInfo($start = null, $type = null, $eventId = null, $end = null)
 {
     // if start and end date are NOT passed, return all events with start_date OR end_date >= today CRM-5133
     if ($start) {
         // get events with start_date >= requested start
         $startDate = CRM_Utils_Type::escape($start, 'Date');
     } else {
         // get events with start date >= today
         $startDate = date("Ymd");
     }
     if ($end) {
         // also get events with end_date >= requested end
         $endDate = CRM_Utils_Type::escape($end, 'Date');
     } else {
         // OR also get events with end date >= today
         $endDate = date("Ymd");
     }
     $dateCondition = "AND (civicrm_event.start_date >= {$startDate} OR civicrm_event.end_date >= {$endDate})";
     if ($type) {
         $typeCondition = " AND civicrm_event.event_type_id = " . CRM_Utils_Type::escape($type, 'Integer');
     }
     // Get the Id of Option Group for Event Types
     require_once 'CRM/Core/DAO/OptionGroup.php';
     $optionGroupDAO = new CRM_Core_DAO_OptionGroup();
     $optionGroupDAO->name = 'event_type';
     $optionGroupId = null;
     if ($optionGroupDAO->find(true)) {
         $optionGroupId = $optionGroupDAO->id;
     }
     $query = "\nSELECT\n  civicrm_event.id as event_id, \n  civicrm_email.email as email, \n  civicrm_event.title as title, \n  civicrm_event.summary as summary, \n  civicrm_event.start_date as start, \n  civicrm_event.end_date as end, \n  civicrm_event.description as description, \n  civicrm_event.is_show_location as is_show_location, \n  civicrm_event.is_online_registration as is_online_registration,\n  civicrm_event.registration_link_text as registration_link_text,\n  civicrm_event.registration_start_date as registration_start_date,\n  civicrm_event.registration_end_date as registration_end_date,\n  civicrm_option_value.label as event_type, \n  civicrm_address.name as address_name, \n  civicrm_address.street_address as street_address, \n  civicrm_address.supplemental_address_1 as supplemental_address_1, \n  civicrm_address.supplemental_address_2 as supplemental_address_2, \n  civicrm_address.city as city, \n  civicrm_address.postal_code as postal_code, \n  civicrm_address.postal_code_suffix as postal_code_suffix, \n  civicrm_state_province.abbreviation as state, \n  civicrm_country.name AS country\nFROM civicrm_event\nLEFT JOIN civicrm_loc_block ON civicrm_event.loc_block_id = civicrm_loc_block.id\nLEFT JOIN civicrm_address ON civicrm_loc_block.address_id = civicrm_address.id\nLEFT JOIN civicrm_state_province ON civicrm_address.state_province_id = civicrm_state_province.id\nLEFT JOIN civicrm_country ON civicrm_address.country_id = civicrm_country.id\nLEFT JOIN civicrm_email ON civicrm_loc_block.email_id = civicrm_email.id\nLEFT JOIN civicrm_option_value ON (\n                                    civicrm_event.event_type_id = civicrm_option_value.value AND\n                                    civicrm_option_value.option_group_id = %1 )\nWHERE civicrm_event.is_active = 1 \n      AND civicrm_event.is_public = 1\n      AND (is_template = 0 OR is_template IS NULL)\n      {$dateCondition}";
     if (isset($typeCondition)) {
         $query .= $typeCondition;
     }
     if (isset($eventId)) {
         $query .= " AND civicrm_event.id ={$eventId} ";
     }
     $query .= " ORDER BY   civicrm_event.start_date ASC";
     $params = array(1 => array($optionGroupId, 'Integer'));
     $dao =& CRM_Core_DAO::executeQuery($query, $params);
     $all = array();
     $config = CRM_Core_Config::singleton();
     $baseURL = parse_url($config->userFrameworkBaseURL);
     $url = "@" . $baseURL['host'];
     if (CRM_Utils_Array::value('path', $baseURL)) {
         $url .= substr($baseURL['path'], 0, -1);
     }
     // check 'view event info' permission
     $permissions = CRM_Core_Permission::event(CRM_Core_Permission::VIEW);
     require_once 'CRM/Utils/String.php';
     while ($dao->fetch()) {
         if (in_array($dao->event_id, $permissions)) {
             $info = array();
             $info['uid'] = "CiviCRM_EventID_{$dao->event_id}_" . md5($config->userFrameworkBaseURL) . $url;
             $info['title'] = $dao->title;
             $info['event_id'] = $dao->event_id;
             $info['summary'] = $dao->summary;
             $info['description'] = $dao->description;
             $info['start_date'] = $dao->start;
             $info['end_date'] = $dao->end;
             $info['contact_email'] = $dao->email;
             $info['event_type'] = $dao->event_type;
             $info['is_show_location'] = $dao->is_show_location;
             $info['is_online_registration'] = $dao->is_online_registration;
             $info['registration_link_text'] = $dao->registration_link_text;
             $info['registration_start_date'] = $dao->registration_start_date;
             $info['registration_end_date'] = $dao->registration_end_date;
             $address = '';
             $addrFields = array('address_name' => $dao->address_name, 'street_address' => $dao->street_address, 'supplemental_address_1' => $dao->supplemental_address_1, 'supplemental_address_2' => $dao->supplemental_address_2, 'city' => $dao->city, 'state_province' => $dao->state, 'postal_code' => $dao->postal_code, 'postal_code_suffix' => $dao->postal_code_suffix, 'country' => $dao->country, 'county' => null);
             require_once 'CRM/Utils/Address.php';
             CRM_Utils_String::append($address, ', ', CRM_Utils_Address::format($addrFields));
             $info['location'] = $address;
             $info['url'] = CRM_Utils_System::url('civicrm/event/info', 'reset=1&id=' . $dao->event_id, true, null, false);
             $all[] = $info;
         }
     }
     return $all;
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:89,代码来源:Event.php

示例2: AND

 /**
  * function to get the complete information for one or more events
  *
  * @param  date    $start      get events with start date >= this date
  * @param  integer $type       get events on the a specific event type (by event_type_id)
  * @param  integer $eventId    return a single event - by event id
  * @param  date    $end        also get events with end date >= this date
  * @param  boolean $onlyPublic include public events only, default TRUE
  *
  * @return  array  $all      array of all the events that are searched
  * @static
  * @access public
  */
 static function &getCompleteInfo($start = NULL, $type = NULL, $eventId = NULL, $end = NULL, $onlyPublic = TRUE)
 {
     $publicCondition = NULL;
     if ($onlyPublic) {
         $publicCondition = "  AND civicrm_event.is_public = 1";
     }
     $dateCondition = '';
     // if start and end date are NOT passed, return all events with start_date OR end_date >= today CRM-5133
     if ($start) {
         // get events with start_date >= requested start
         $startDate = CRM_Utils_Type::escape($start, 'Date');
         $dateCondition .= " AND ( civicrm_event.start_date >= {$startDate} )";
     }
     if ($end) {
         // also get events with end_date <= requested end
         $endDate = CRM_Utils_Type::escape($end, 'Date');
         $dateCondition .= " AND ( civicrm_event.end_date <= '{$endDate}' ) ";
     }
     // CRM-9421 and CRM-8620 Default mode for ical/rss feeds. No start or end filter passed.
     // Need to exclude old events with only start date
     // and not exclude events in progress (start <= today and end >= today). DGG
     if (empty($start) && empty($end)) {
         // get events with end date >= today, not sure of this logic
         // but keeping this for backward compatibility as per issue CRM-5133
         $today = date("Y-m-d G:i:s");
         $dateCondition .= " AND ( civicrm_event.end_date >= '{$today}' OR civicrm_event.start_date >= '{$today}' ) ";
     }
     if ($type) {
         $typeCondition = " AND civicrm_event.event_type_id = " . CRM_Utils_Type::escape($type, 'Integer');
     }
     // Get the Id of Option Group for Event Types
     $optionGroupDAO = new CRM_Core_DAO_OptionGroup();
     $optionGroupDAO->name = 'event_type';
     $optionGroupId = NULL;
     if ($optionGroupDAO->find(TRUE)) {
         $optionGroupId = $optionGroupDAO->id;
     }
     $query = "\nSELECT\n  civicrm_event.id as event_id,\n  civicrm_email.email as email,\n  civicrm_event.title as title,\n  civicrm_event.summary as summary,\n  civicrm_event.start_date as start,\n  civicrm_event.end_date as end,\n  civicrm_event.description as description,\n  civicrm_event.is_show_location as is_show_location,\n  civicrm_event.is_online_registration as is_online_registration,\n  civicrm_event.registration_link_text as registration_link_text,\n  civicrm_event.registration_start_date as registration_start_date,\n  civicrm_event.registration_end_date as registration_end_date,\n  civicrm_option_value.label as event_type,\n  civicrm_address.name as address_name,\n  civicrm_address.street_address as street_address,\n  civicrm_address.supplemental_address_1 as supplemental_address_1,\n  civicrm_address.supplemental_address_2 as supplemental_address_2,\n  civicrm_address.city as city,\n  civicrm_address.postal_code as postal_code,\n  civicrm_address.postal_code_suffix as postal_code_suffix,\n  civicrm_state_province.abbreviation as state,\n  civicrm_country.name AS country\nFROM civicrm_event\nLEFT JOIN civicrm_loc_block ON civicrm_event.loc_block_id = civicrm_loc_block.id\nLEFT JOIN civicrm_address ON civicrm_loc_block.address_id = civicrm_address.id\nLEFT JOIN civicrm_state_province ON civicrm_address.state_province_id = civicrm_state_province.id\nLEFT JOIN civicrm_country ON civicrm_address.country_id = civicrm_country.id\nLEFT JOIN civicrm_email ON civicrm_loc_block.email_id = civicrm_email.id\nLEFT JOIN civicrm_option_value ON (\n                                    civicrm_event.event_type_id = civicrm_option_value.value AND\n                                    civicrm_option_value.option_group_id = %1 )\nWHERE civicrm_event.is_active = 1\n      AND (is_template = 0 OR is_template IS NULL)\n      {$publicCondition}\n      {$dateCondition}";
     if (isset($typeCondition)) {
         $query .= $typeCondition;
     }
     if (isset($eventId)) {
         $query .= " AND civicrm_event.id ={$eventId} ";
     }
     $query .= " ORDER BY   civicrm_event.start_date ASC";
     $params = array(1 => array($optionGroupId, 'Integer'));
     $dao = CRM_Core_DAO::executeQuery($query, $params);
     $all = array();
     $config = CRM_Core_Config::singleton();
     $baseURL = parse_url($config->userFrameworkBaseURL);
     $url = "@" . $baseURL['host'];
     if (!empty($baseURL['path'])) {
         $url .= substr($baseURL['path'], 0, -1);
     }
     // check 'view event info' permission
     //@todo - per CRM-14626 we have resolved that 'view event info' means 'view ALL event info'
     // and passing in the specific permission here will short-circuit the evaluation of permission to
     // see specific events (doesn't seem relevant to this call
     // however, since this function is accessed only by a convoluted call from a joomla block function
     // it seems safer not to touch here. Suggestion is that CRM_Core_Permission::check(array or relevant permissions) would
     // be clearer & safer here
     $permissions = CRM_Core_Permission::event(CRM_Core_Permission::VIEW);
     // check if we're in shopping cart mode for events
     $enable_cart = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::EVENT_PREFERENCES_NAME, 'enable_cart');
     if ($enable_cart) {
     }
     while ($dao->fetch()) {
         if (!empty($permissions) && in_array($dao->event_id, $permissions)) {
             $info = array();
             $info['uid'] = "CiviCRM_EventID_{$dao->event_id}_" . md5($config->userFrameworkBaseURL) . $url;
             $info['title'] = $dao->title;
             $info['event_id'] = $dao->event_id;
             $info['summary'] = $dao->summary;
             $info['description'] = $dao->description;
             $info['start_date'] = $dao->start;
             $info['end_date'] = $dao->end;
             $info['contact_email'] = $dao->email;
             $info['event_type'] = $dao->event_type;
             $info['is_show_location'] = $dao->is_show_location;
             $info['is_online_registration'] = $dao->is_online_registration;
             $info['registration_link_text'] = $dao->registration_link_text;
             $info['registration_start_date'] = $dao->registration_start_date;
             $info['registration_end_date'] = $dao->registration_end_date;
             $address = '';
             $addrFields = array('address_name' => $dao->address_name, 'street_address' => $dao->street_address, 'supplemental_address_1' => $dao->supplemental_address_1, 'supplemental_address_2' => $dao->supplemental_address_2, 'city' => $dao->city, 'state_province' => $dao->state, 'postal_code' => $dao->postal_code, 'postal_code_suffix' => $dao->postal_code_suffix, 'country' => $dao->country, 'county' => NULL);
             CRM_Utils_String::append($address, ', ', CRM_Utils_Address::format($addrFields));
             $info['location'] = $address;
//.........这里部分代码省略.........
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:101,代码来源:Event.php

示例3: implode

 /**
  * Get the information to map a contact.
  *
  * @param array $ids
  *   The list of ids for which we want map info.
  * $param  int    $locationTypeID
  *
  * @param int $locationTypeID
  * @param bool $imageUrlOnly
  *
  * @return null|string
  *   display name of the contact if found
  */
 public static function &getMapInfo($ids, $locationTypeID = NULL, $imageUrlOnly = FALSE)
 {
     $idString = ' ( ' . implode(',', $ids) . ' ) ';
     $sql = "\n   SELECT civicrm_contact.id as contact_id,\n          civicrm_contact.contact_type as contact_type,\n          civicrm_contact.contact_sub_type as contact_sub_type,\n          civicrm_contact.display_name as display_name,\n          civicrm_address.street_address as street_address,\n          civicrm_address.supplemental_address_1 as supplemental_address_1,\n          civicrm_address.supplemental_address_2 as supplemental_address_2,\n          civicrm_address.city as city,\n          civicrm_address.postal_code as postal_code,\n          civicrm_address.postal_code_suffix as postal_code_suffix,\n          civicrm_address.geo_code_1 as latitude,\n          civicrm_address.geo_code_2 as longitude,\n          civicrm_state_province.abbreviation as state,\n          civicrm_country.name as country,\n          civicrm_location_type.name as location_type\n     FROM civicrm_contact\nLEFT JOIN civicrm_address ON civicrm_address.contact_id = civicrm_contact.id\nLEFT JOIN civicrm_state_province ON civicrm_address.state_province_id = civicrm_state_province.id\nLEFT JOIN civicrm_country ON civicrm_address.country_id = civicrm_country.id\nLEFT JOIN civicrm_location_type ON civicrm_location_type.id = civicrm_address.location_type_id\nWHERE civicrm_address.geo_code_1 IS NOT NULL\nAND civicrm_address.geo_code_2 IS NOT NULL\nAND civicrm_contact.id IN {$idString} ";
     $params = array();
     if (!$locationTypeID) {
         $sql .= " AND civicrm_address.is_primary = 1";
     } else {
         $sql .= " AND civicrm_address.location_type_id = %1";
         $params[1] = array($locationTypeID, 'Integer');
     }
     $dao = CRM_Core_DAO::executeQuery($sql, $params);
     $locations = array();
     $config = CRM_Core_Config::singleton();
     while ($dao->fetch()) {
         $location = array();
         $location['contactID'] = $dao->contact_id;
         $location['displayName'] = addslashes($dao->display_name);
         $location['city'] = $dao->city;
         $location['state'] = $dao->state;
         $location['postal_code'] = $dao->postal_code;
         $location['lat'] = $dao->latitude;
         $location['lng'] = $dao->longitude;
         $location['marker_class'] = $dao->contact_type;
         $address = '';
         CRM_Utils_String::append($address, '<br />', array($dao->street_address, $dao->supplemental_address_1, $dao->supplemental_address_2, $dao->city));
         CRM_Utils_String::append($address, ', ', array($dao->state, $dao->postal_code));
         CRM_Utils_String::append($address, '<br /> ', array($dao->country));
         $location['address'] = addslashes($address);
         $location['displayAddress'] = str_replace('<br />', ', ', addslashes($address));
         $location['url'] = CRM_Utils_System::url('civicrm/contact/view', 'reset=1&cid=' . $dao->contact_id);
         $location['location_type'] = $dao->location_type;
         $location['image'] = CRM_Contact_BAO_Contact_Utils::getImage(isset($dao->contact_sub_type) ? $dao->contact_sub_type : $dao->contact_type, $imageUrlOnly, $dao->contact_id);
         $locations[] = $location;
     }
     return $locations;
 }
开发者ID:BorislavZlatanov,项目名称:civicrm-core,代码行数:50,代码来源:Location.php

示例4: buildPermissionLinks

 /**
  * This function return all voter links with respecting permissions.
  *
  * @param int $surveyId
  * @param bool $enclosedInUL
  * @param string $extraULName
  * @return array|string
  *   $url array of permissioned links
  */
 public static function buildPermissionLinks($surveyId, $enclosedInUL = FALSE, $extraULName = 'more')
 {
     $menuLinks = array();
     if (!$surveyId) {
         return $menuLinks;
     }
     static $voterLinks = array();
     if (empty($voterLinks)) {
         $permissioned = FALSE;
         if (CRM_Core_Permission::check('manage campaign') || CRM_Core_Permission::check('administer CiviCampaign')) {
             $permissioned = TRUE;
         }
         if ($permissioned || CRM_Core_Permission::check("reserve campaign contacts")) {
             $voterLinks['reserve'] = array('name' => 'reserve', 'url' => 'civicrm/survey/search', 'qs' => 'sid=%%id%%&reset=1&op=reserve', 'title' => ts('Reserve Respondents'));
         }
         if ($permissioned || CRM_Core_Permission::check("interview campaign contacts")) {
             $voterLinks['release'] = array('name' => 'interview', 'url' => 'civicrm/survey/search', 'qs' => 'sid=%%id%%&reset=1&op=interview&force=1', 'title' => ts('Interview Respondents'));
         }
         if ($permissioned || CRM_Core_Permission::check("release campaign contacts")) {
             $voterLinks['interview'] = array('name' => 'release', 'url' => 'civicrm/survey/search', 'qs' => 'sid=%%id%%&reset=1&op=release&force=1', 'title' => ts('Release Respondents'));
         }
     }
     if (CRM_Core_Permission::check('access CiviReport')) {
         $reportID = self::getReportID($surveyId);
         if ($reportID) {
             $voterLinks['report'] = array('name' => 'report', 'url' => "civicrm/report/instance/{$reportID}", 'qs' => 'reset=1', 'title' => ts('View Survey Report'));
         }
     }
     $ids = array('id' => $surveyId);
     foreach ($voterLinks as $link) {
         if (!empty($link['qs']) && !CRM_Utils_System::isNull($link['qs'])) {
             $urlPath = CRM_Utils_System::url(CRM_Core_Action::replace($link['url'], $ids), CRM_Core_Action::replace($link['qs'], $ids));
             $menuLinks[] = sprintf('<a href="%s" class="action-item crm-hover-button" title="%s">%s</a>', $urlPath, CRM_Utils_Array::value('title', $link), $link['title']);
         }
     }
     if ($enclosedInUL) {
         $extraLinksName = strtolower($extraULName);
         $allLinks = '';
         CRM_Utils_String::append($allLinks, '</li><li>', $menuLinks);
         $allLinks = "{$extraULName} <ul id='panel_{$extraLinksName}_xx' class='panel'><li>{$allLinks}</li></ul>";
         $menuLinks = "<span class='btn-slide crm-hover-button' id={$extraLinksName}_xx>{$allLinks}</span>";
     }
     return $menuLinks;
 }
开发者ID:BorislavZlatanov,项目名称:civicrm-core,代码行数:53,代码来源:Survey.php

示例5: formLink

 /**
  * given a set of links and a mask, return the html action string for
  * the links associated with the mask
  *
  * @param array $links the set of link items
  * @param int $mask the mask to be used. a null mask means all items
  * @param array $values the array of values for parameter substitution in the link items
  * @param string $extraULName enclosed extra links in this UL.
  * @param boolean $enclosedAllInSingleUL force to enclosed all links in single UL.
  *
  * @param null $op
  * @param null $objectName
  * @param null $objectId
  *
  * @return string       the html string
  * @access public
  * @static
  */
 static function formLink($links, $mask, $values, $extraULName = 'more', $enclosedAllInSingleUL = FALSE, $op = NULL, $objectName = NULL, $objectId = NULL)
 {
     $config = CRM_Core_Config::singleton();
     if (empty($links)) {
         return NULL;
     }
     // make links indexed sequentially instead of by bitmask
     // otherwise it's next to impossible to reliably add new ones
     $seqLinks = array();
     foreach ($links as $bit => $link) {
         $link['bit'] = $bit;
         $seqLinks[] = $link;
     }
     if ($op && $objectName && $objectId) {
         CRM_Utils_Hook::links($op, $objectName, $objectId, $seqLinks, $mask, $values);
     }
     $url = array();
     foreach ($seqLinks as $i => $link) {
         if (!$mask || !array_key_exists('bit', $link) || $mask & $link['bit']) {
             $extra = isset($link['extra']) ? self::replace($link['extra'], $values) : NULL;
             $frontend = isset($link['fe']) ? TRUE : FALSE;
             if (isset($link['qs']) && !CRM_Utils_System::isNull($link['qs'])) {
                 $urlPath = CRM_Utils_System::url(self::replace($link['url'], $values), self::replace($link['qs'], $values), TRUE, NULL, TRUE, $frontend);
             } else {
                 $urlPath = CRM_Utils_Array::value('url', $link, '#');
             }
             $classes = 'action-item crm-hover-button';
             if (isset($link['ref'])) {
                 $classes .= ' ' . strtolower($link['ref']);
             }
             //get the user specified classes in.
             if (isset($link['class'])) {
                 $className = is_array($link['class']) ? implode(' ', $link['class']) : $link['class'];
                 $classes .= ' ' . strtolower($className);
             }
             if ($urlPath !== '#' && $frontend) {
                 $extra .= ' target="_blank"';
             }
             // Hack to make delete dialogs smaller
             if (strpos($urlPath, '/delete') || strpos($urlPath, 'action=delete')) {
                 $classes .= " small-popup";
             }
             $url[] = sprintf('<a href="%s" class="%s" %s' . $extra . '>%s</a>', $urlPath, $classes, !empty($link['title']) ? "title='{$link['title']}' " : '', $link['name']);
         }
     }
     $mainLinks = $url;
     if ($enclosedAllInSingleUL) {
         $allLinks = '';
         CRM_Utils_String::append($allLinks, '</li><li>', $mainLinks);
         $allLinks = "{$extraULName}<ul class='panel'><li>{$allLinks}</li></ul>";
         $result = "<span class='btn-slide crm-hover-button'>{$allLinks}</span>";
     } else {
         $extra = '';
         $extraLinks = array_splice($url, 2);
         if (count($extraLinks) > 1) {
             $mainLinks = array_slice($url, 0, 2);
             CRM_Utils_String::append($extra, '</li><li>', $extraLinks);
             $extra = "{$extraULName}<ul class='panel'><li>{$extra}</li></ul>";
         }
         $resultLinks = '';
         CRM_Utils_String::append($resultLinks, '', $mainLinks);
         if ($extra) {
             $result = "<span>{$resultLinks}</span><span class='btn-slide crm-hover-button'>{$extra}</span>";
         } else {
             $result = "<span>{$resultLinks}</span>";
         }
     }
     return $result;
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:87,代码来源:Action.php

示例6: formLink

 /**
  * given a set of links and a mask, return the html action string for
  * the links associated with the mask
  *
  * @param array $links  the set of link items
  * @param int   $mask   the mask to be used. a null mask means all items
  * @param array $values the array of values for parameter substitution in the link items
  *
  * @return string       the html string
  * @access public
  * @static
  */
 function formLink(&$links, $mask, $values)
 {
     $url = array();
     foreach ($links as $m => $link) {
         if (!$mask || $mask & $m) {
             $extra = CRM_Utils_Array::value('extra', $link, '');
             $url[] = sprintf('<a href="%s" ' . $extra . '>%s</a>', CRM_Utils_System::url($link['url'], CRM_Core_Action::replace($link['qs'], $values)), $link['name']);
         }
     }
     $result = '';
     CRM_Utils_String::append($result, '&nbsp;|&nbsp;', $url);
     return $result;
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:25,代码来源:Action.php

示例7: formLink

 /**
  * given a set of links and a mask, return the html action string for
  * the links associated with the mask
  *
  * @param array $links  the set of link items
  * @param int   $mask   the mask to be used. a null mask means all items
  * @param array $values the array of values for parameter substitution in the link items
  * @param string  $extraULName            enclosed extra links in this UL.
  * @param boolean $enclosedAllInSingleUL  force to enclosed all links in single UL.
  *
  * @return string       the html string
  * @access public
  * @static
  */
 static function formLink($links, $mask, $values, $extraULName = 'more', $enclosedAllInSingleUL = FALSE, $op = NULL, $objectName = NULL, $objectId = NULL)
 {
     $config = CRM_Core_Config::singleton();
     if (empty($links)) {
         return NULL;
     }
     if ($op && $objectName && $objectId) {
         CRM_Utils_Hook::links($op, $objectName, $objectId, $links, $mask);
     }
     $url = array();
     $firstLink = TRUE;
     foreach ($links as $m => $link) {
         if (!$mask || $mask & $m) {
             $extra = isset($link['extra']) ? self::replace($link['extra'], $values) : NULL;
             $frontend = isset($link['fe']) ? TRUE : FALSE;
             $urlPath = NULL;
             if (CRM_Utils_Array::value('qs', $link) && !CRM_Utils_System::isNull($link['qs'])) {
                 $urlPath = CRM_Utils_System::url(self::replace($link['url'], $values), self::replace($link['qs'], $values), TRUE, NULL, TRUE, $frontend);
             } else {
                 $urlPath = CRM_Utils_Array::value('url', $link);
             }
             $classes = 'action-item';
             if ($firstLink) {
                 $firstLink = FALSE;
                 $classes .= " action-item-first";
             }
             if (isset($link['ref'])) {
                 $classes .= ' ' . strtolower($link['ref']);
             }
             //get the user specified classes in.
             if (isset($link['class'])) {
                 $className = $link['class'];
                 if (is_array($className)) {
                     $className = implode(' ', $className);
                 }
                 $classes .= ' ' . strtolower($className);
             }
             $linkClasses = 'class = "' . $classes . '"';
             if ($urlPath) {
                 if ($frontend) {
                     $extra .= "target=_blank";
                 }
                 $url[] = sprintf('<a href="%s" %s title="%s"' . $extra . '>%s</a>', $urlPath, $linkClasses, CRM_Utils_Array::value('title', $link), $link['name']);
             } else {
                 $url[] = sprintf('<a title="%s"  %s ' . $extra . '>%s</a>', CRM_Utils_Array::value('title', $link), $linkClasses, $link['name']);
             }
         }
     }
     $result = '';
     $mainLinks = $url;
     if ($enclosedAllInSingleUL) {
         $allLinks = '';
         CRM_Utils_String::append($allLinks, '</li><li>', $mainLinks);
         $allLinks = "{$extraULName}<ul class='panel'><li>{$allLinks}</li></ul>";
         $result = "<span class='btn-slide'>{$allLinks}</span>";
     } else {
         $extra = '';
         $extraLinks = array_splice($url, 2);
         if (count($extraLinks) > 1) {
             $mainLinks = array_slice($url, 0, 2);
             CRM_Utils_String::append($extra, '</li><li>', $extraLinks);
             $extra = "{$extraULName}<ul class='panel'><li>{$extra}</li></ul>";
         }
         $resultLinks = '';
         CRM_Utils_String::append($resultLinks, '', $mainLinks);
         if ($extra) {
             $result = "<span>{$resultLinks}</span><span class='btn-slide'>{$extra}</span>";
         } else {
             $result = "<span>{$resultLinks}</span>";
         }
     }
     return $result;
 }
开发者ID:hguru,项目名称:224Civi,代码行数:87,代码来源:Action.php

示例8: formLink

 /**
  * given a set of links and a mask, return the html action string for
  * the links associated with the mask
  *
  * @param array $links  the set of link items
  * @param int   $mask   the mask to be used. a null mask means all items
  * @param array $values the array of values for parameter substitution in the link items
  *
  * @return string       the html string
  * @access public
  * @static
  */
 static function formLink(&$links, $mask, $values)
 {
     $config =& CRM_Core_Config::singleton();
     if (empty($links)) {
         return null;
     }
     $url = array();
     $firstLink = true;
     foreach ($links as $m => $link) {
         if (!$mask || $mask & $m) {
             $extra = null;
             if (isset($link['extra'])) {
                 $extra = self::replace(CRM_Utils_Array::value('extra', $link, ''), $values);
             }
             $urlPath = null;
             if (CRM_Utils_Array::value('qs', $link) && !CRM_Utils_System::isNull($link['qs'])) {
                 $urlPath = CRM_Utils_System::url(self::replace($link['url'], $values), self::replace($link['qs'], $values), true);
             } else {
                 $urlPath = CRM_Utils_Array::value('url', $link);
             }
             $ref = '';
             if (isset($link['ref'])) {
                 $ref = "class = {$link['ref']}";
             }
             $linkClass = "action-item";
             if ($firstLink) {
                 $linkClass .= " action-item-first";
                 $firstLink = false;
             }
             if ($urlPath) {
                 $url[] = sprintf('<a href="%s" class="%s" title="%s" %s ' . $extra . '>%s</a>', $urlPath, $linkClass, $link['title'], $ref, $link['name']);
             } else {
                 $linkClass .= ' ' . strtolower($link['name']) . '-action';
                 $url[] = sprintf('<a title="%s" class="%s" %s ' . $extra . '>%s</a>', $link['title'], $linkClass, $ref, $link['name']);
             }
         }
     }
     $result = $resultDiv = '';
     $actionLink = $url;
     $actionDiv = array_splice($url, 2);
     $showDiv = false;
     if (count($actionDiv) > 1) {
         $actionLink = array_slice($url, 0, 2);
         $showDiv = true;
     }
     require_once 'CRM/Utils/String.php';
     CRM_Utils_String::append($resultLink, '', $actionLink);
     if ($showDiv) {
         CRM_Utils_String::append($resultDiv, '</li><li>', $actionDiv);
         $resultDiv = ts('more') . "<ul id='panel_xx' class='panel'><li>{$resultDiv}</li></ul>";
     }
     if ($resultDiv) {
         $result = "<span>{$resultLink}</span><span class='btn-slide' id=xx>{$resultDiv}</span>";
     } else {
         $result = "<span>{$resultLink}</span>";
     }
     return $result;
 }
开发者ID:bhirsch,项目名称:civicrm,代码行数:70,代码来源:Action.php

示例9: formLink

 /**
  * given a set of links and a mask, return the html action string for
  * the links associated with the mask
  *
  * @param array $links  the set of link items
  * @param int   $mask   the mask to be used. a null mask means all items
  * @param array $values the array of values for parameter substitution in the link items
  * @param string  $extraULName            enclosed extra links in this UL.
  * @param boolean $enclosedAllInSingleUL  force to enclosed all links in single UL.
  * 
  * @return string       the html string
  * @access public
  * @static
  */
 static function formLink(&$links, $mask, $values, $extraULName = 'more', $enclosedAllInSingleUL = false)
 {
     $config = CRM_Core_Config::singleton();
     if (empty($links)) {
         return null;
     }
     $url = array();
     $firstLink = true;
     foreach ($links as $m => $link) {
         if (!$mask || $mask & $m) {
             $extra = null;
             if (isset($link['extra'])) {
                 $extra = self::replace(CRM_Utils_Array::value('extra', $link, ''), $values);
             }
             $frontend = false;
             if (isset($link['fe'])) {
                 $frontend = true;
             }
             $urlPath = null;
             if (CRM_Utils_Array::value('qs', $link) && !CRM_Utils_System::isNull($link['qs'])) {
                 $urlPath = CRM_Utils_System::url(self::replace($link['url'], $values), self::replace($link['qs'], $values), true, null, true, $frontend);
             } else {
                 $urlPath = CRM_Utils_Array::value('url', $link);
             }
             $classes = 'action-item';
             if ($firstLink) {
                 $firstLink = false;
                 $classes .= " action-item-first";
             }
             if (isset($link['ref'])) {
                 $classes .= ' ' . strtolower($link['ref']);
             }
             //get the user specified classes in.
             if (isset($link['class'])) {
                 $className = $link['class'];
                 if (is_array($className)) {
                     $className = implode(' ', $className);
                 }
                 $classes .= ' ' . strtolower($className);
             }
             $linkClasses = 'class = "' . $classes . '"';
             if ($urlPath) {
                 if ($frontend) {
                     $extra .= "target=_blank";
                 }
                 $url[] = sprintf('<a href="%s" %s title="%s"' . $extra . '>%s</a>', $urlPath, $linkClasses, CRM_Utils_Array::value('title', $link), $link['name']);
             } else {
                 $url[] = sprintf('<a title="%s"  %s ' . $extra . '>%s</a>', CRM_Utils_Array::value('title', $link), $linkClasses, $link['name']);
             }
         }
     }
     require_once 'CRM/Utils/String.php';
     $result = '';
     $mainLinks = $url;
     $extraLinksName = strtolower($extraULName);
     if ($enclosedAllInSingleUL) {
         $allLinks = '';
         CRM_Utils_String::append($allLinks, '</li><li>', $mainLinks);
         $allLinks = "{$extraULName} <ul id='panel_{$extraLinksName}_xx' class='panel'><li>{$allLinks}</li></ul>";
         $result = "<span class='btn-slide' id={$extraLinksName}_xx>{$allLinks}</span>";
     } else {
         $extra = '';
         $extraLinks = array_splice($url, 2);
         if (count($extraLinks) > 1) {
             $mainLinks = array_slice($url, 0, 2);
             CRM_Utils_String::append($extra, '</li><li>', $extraLinks);
             $extra = "{$extraULName} <ul id='panel_{$extraLinksName}_xx' class='panel'><li>{$extra}</li></ul>";
         }
         $resultLinks = '';
         CRM_Utils_String::append($resultLinks, '', $mainLinks);
         if ($extra) {
             $result = "<span>{$resultLinks}</span><span class='btn-slide' id={$extraLinksName}_xx>{$extra}</span>";
         } else {
             $result = "<span>{$resultLinks}</span>";
         }
     }
     return $result;
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:92,代码来源:Action.php

示例10: implode

 /**
  * function to get the information to map a contact
  *
  * @param  array  $ids    the list of ids for which we want map info
  * $param  int    $locationId location_id
  *
  * @return null|string     display name of the contact if found
  * @static
  * @access public
  */
 function &getMapInfo($ids, $locationId = null)
 {
     $idString = ' ( ' . implode(',', $ids) . ' ) ';
     $sql = "\nSELECT\n  civicrm_contact.id as contact_id,\n  civicrm_contact.contact_type as contact_type,\n  civicrm_contact.display_name as display_name,\n  civicrm_address.street_address as street_address,\n  civicrm_address.city as city,\n  civicrm_address.postal_code as postal_code,\n  civicrm_address.postal_code_suffix as postal_code_suffix,\n  civicrm_address.geo_code_1 as latitude,\n  civicrm_address.geo_code_2 as longitude,\n  civicrm_state_province.abbreviation as state,\n  civicrm_country.name as country,\n  civicrm_location_type.name as location_type\nFROM civicrm_contact\nLEFT JOIN civicrm_location ON (civicrm_location.entity_table = 'civicrm_contact' AND\n                               civicrm_contact.id = civicrm_location.entity_id";
     if (!$locationId) {
         $sql .= " AND civicrm_location.is_primary = 1";
     } else {
         $sql .= " AND civicrm_location.id = " . CRM_Utils_Type::escape($locationId, 'Integer');
     }
     $sql .= ")\nLEFT JOIN civicrm_address ON civicrm_location.id = civicrm_address.location_id\nLEFT JOIN civicrm_state_province ON civicrm_address.state_province_id = civicrm_state_province.id\nLEFT JOIN civicrm_country ON civicrm_address.country_id = civicrm_country.id\nLEFT JOIN civicrm_location_type ON civicrm_location_type.id = civicrm_location.location_type_id\nWHERE civicrm_contact.id IN {$idString} AND civicrm_address.geo_code_1 is not null AND civicrm_address.geo_code_2 is not null";
     $dao =& new CRM_Core_DAO();
     $dao->query($sql);
     $locations = array();
     $config =& CRM_Core_Config::singleton();
     while ($dao->fetch()) {
         $location = array();
         $location['displayName'] = $dao->display_name;
         $location['lat'] = $dao->latitude;
         $location['lng'] = $dao->longitude;
         $address = '';
         /*CRM_Utils_String::append( $address, ', ',
           array( $dao->street_address, $dao->city, $dao->state, $dao->postal_code, $dao->country ) );*/
         CRM_Utils_String::append($address, '<br />', array($dao->street_address, $dao->city));
         CRM_Utils_String::append($address, ', ', array($dao->state, $dao->postal_code));
         CRM_Utils_String::append($address, '<br /> ', array($dao->country));
         $location['address'] = $address;
         $location['url'] = CRM_Utils_System::url('civicrm/contact/view', 'reset=1&cid=' . $dao->contact_id);
         $location['location_type'] = $dao->location_type;
         $contact_type = '<img src="' . $config->resourceBase . 'i/contact_';
         switch ($dao->contact_type) {
             case 'Individual':
                 $contact_type .= 'ind_medium.gif" alt="' . ts('Individual') . '" />';
                 break;
             case 'Household':
                 $contact_type .= 'house.png" alt="' . ts('Household') . '" height="25" width="25" />';
                 break;
             case 'Organization':
                 $contact_type .= 'org.gif" alt="' . ts('Organization') . '" height="25" width="30" />';
                 break;
         }
         $location['contactImage'] = $contact_type;
         $locations[] = $location;
     }
     return $locations;
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:55,代码来源:Contact.php


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