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


PHP Kurogo::moduleLinkForValue方法代码示例

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


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

示例1: formatDetail

 protected function formatDetail($values, $info, Person $person)
 {
     if (isset($info['format'])) {
         $value = vsprintf($this->replaceFormat($info['format']), $values);
     } else {
         $value = implode(' ', $values);
     }
     $detail = array('label' => isset($info['label']) ? $info['label'] : '', 'title' => $value);
     switch (isset($info['type']) ? $info['type'] : 'text') {
         case 'email':
             $detail['title'] = str_replace('@', '@­', $detail['title']);
             $detail['url'] = "mailto:{$value}";
             $detail['class'] = 'email';
             break;
         case 'phone':
             $detail['title'] = str_replace('-', '-­', $detail['title']);
             if (strpos($value, '+1') !== 0) {
                 $value = "+1{$value}";
             }
             $detail['url'] = 'tel:' . strtr($value, '-', '');
             $detail['class'] = 'phone';
             break;
             // compatibility
         // compatibility
         case 'map':
             $info['module'] = 'map';
             break;
     }
     if (isset($info['module'])) {
         $detail = array_merge($detail, Kurogo::moduleLinkForValue($info['module'], $value, $this, $person));
     }
     if (isset($info['urlfunc'])) {
         $urlFunction = create_function('$value,$person', $info['urlfunc']);
         $detail['url'] = $urlFunction($value, $person);
     }
     $detail['title'] = nl2br($detail['title']);
     return $detail;
 }
开发者ID:hxfnd,项目名称:Kurogo-Mobile-Web,代码行数:38,代码来源:PeopleWebModule.php

示例2: initializeForPage


//.........这里部分代码省略.........
                 $field = array();
                 $value = $event->get_attribute($key);
                 if (empty($value)) {
                     continue;
                 }
                 if (isset($info['label'])) {
                     $field['label'] = $info['label'];
                 }
                 if (isset($info['class'])) {
                     $field['class'] = $info['class'];
                 }
                 if (is_array($value)) {
                     $fieldValues = array();
                     foreach ($value as $item) {
                         $fieldValue = '';
                         $fieldValueUrl = null;
                         if (isset($info['type'])) {
                             $fieldValue = $this->valueForType($info['type'], $item);
                             $fieldValueUrl = $this->urlForType($info['type'], $item);
                         } else {
                             $fieldValue = $item;
                         }
                         if (isset($fieldValueUrl)) {
                             $fieldValue = '<a href="' . $fieldValueUrl . '">' . $fieldValue . '</a>';
                         }
                         $fieldValues[] = $fieldValue;
                     }
                     $field['title'] = implode(', ', $fieldValues);
                 } else {
                     if (isset($info['type'])) {
                         $field['title'] = $this->valueForType($info['type'], $value);
                         $field['url'] = $this->urlForType($info['type'], $value);
                     } elseif (isset($info['module'])) {
                         $field = array_merge($field, Kurogo::moduleLinkForValue($info['module'], $value, $this, $event));
                     } else {
                         $field['title'] = nl2br($value);
                     }
                 }
                 if (isset($info['urlfunc'])) {
                     $urlFunction = create_function('$value,$event', $info['urlfunc']);
                     $field['url'] = $urlFunction($value, $event);
                 }
                 $fields[] = $field;
             }
             $this->assign('fields', $fields);
             //error_log(print_r($fields, true));
             break;
         case 'search':
             if ($filter = $this->getArg('filter')) {
                 $searchTerms = trim($filter);
                 $timeframe = $this->getArg('timeframe', 0);
                 $type = $this->getArg('type', 'static');
                 $searchCalendar = $this->getArg('calendar', $this->getDefaultFeed($type));
                 if (preg_match("/^(.*?)\\|(.*?)\$/", $searchCalendar, $bits)) {
                     $type = $bits[1];
                     $calendar = $bits[2];
                 } else {
                     $calendar = $searchCalendar;
                 }
                 $options = array('type' => $type, 'calendar' => $calendar, 'timeframe' => $timeframe);
                 $this->setLogData($searchTerms);
                 $iCalEvents = $this->searchItems($searchTerms, null, $options);
                 $events = array();
                 foreach ($iCalEvents as $iCalEvent) {
                     $events[] = $this->linkForItem($iCalEvent, array('filter' => $searchTerms, 'timeframe' => $timeframe, 'calendar' => $calendar, 'type' => $type));
                 }
开发者ID:narenv,项目名称:Kurogo-Mobile-Web,代码行数:67,代码来源:CalendarWebModule.php

示例3: formatPersonByNative

 private function formatPersonByNative($person)
 {
     $result = array();
     $result['uid'] = $person->getId();
     foreach ($this->fieldConfig as $fieldID => $fieldOptions) {
         $attributes = array();
         for ($i = 0; $i < count($fieldOptions['attributes']); $i++) {
             if (isset($fieldOptions['labels'])) {
                 $label = $fieldOptions['labels'][$i];
             } else {
                 $label = $i;
             }
             $attribute = $fieldOptions['attributes'][$i];
             $values = $person->getField($attribute);
             if ($values) {
                 if (self::argVal($fieldOptions, 'type') == 'imgdata') {
                     $attributes[$label] = FULL_URL_PREFIX . $this->configModule . '/photo?' . http_build_query(array('uid' => $person->getID()));
                 } else {
                     if (is_array($values)) {
                         $delimiter = isset($fieldOptions['delimiter']) ? $fieldOptions['delimiter'] : ' ';
                         $attributes[$label] = implode($delimiter, $values);
                     } else {
                         $attributes[$label] = $values;
                     }
                 }
             } elseif (isset($fieldOptions['format'])) {
                 //always include attributes when using format
                 $attributes[$label] = null;
             }
         }
         // if we use format and there are no fields then skip
         if (isset($fieldOptions['format'])) {
             if (!array_filter($attributes)) {
                 $attributes = array();
             }
         }
         if ($attributes) {
             if (isset($fieldOptions['format'])) {
                 $value = vsprintf($fieldOptions['format'], $attributes);
             } elseif (isset($fieldOptions['parse'])) {
                 $formatFunction = create_function('$value', $fieldOptions['parse']);
                 $value = $formatFunction($attributes);
             } elseif (isset($fieldOptions['labels'])) {
                 $value = $attributes;
             } else {
                 $value = $attributes[0];
             }
             $url = NULL;
             if (self::argVal($fieldOptions, 'type') == 'map') {
                 $link = Kurogo::moduleLinkForValue('map', $value, $this, $person);
                 if (isset($link, $link['url'])) {
                     $url = $link['url'];
                 }
             }
             if (isset($fieldOptions['section'])) {
                 $section = $fieldOptions['section'];
                 if (!isset($result[$section])) {
                     $result[$section] = array();
                 }
                 $valueArray = array('title' => $fieldOptions['label'], 'type' => $fieldOptions['type'], 'value' => $value);
                 if (isset($url)) {
                     $valueArray['url'] = $url;
                 }
                 $result[$section][] = $valueArray;
             } else {
                 $result[$fieldOptions['label']] = $value;
             }
         }
     }
     return $result;
 }
开发者ID:sponto,项目名称:Kurogo-Mobile-Web,代码行数:71,代码来源:PeopleAPIModule.php

示例4: initializeSchedule

 protected function initializeSchedule()
 {
     $locationID = $this->getArg('section');
     $eventID = $this->getArg('id');
     $feedID = $this->getArg('groupID');
     $model = $this->loadFeed($feedID);
     $location = $model->getLocation($locationID);
     $locationEvents = $location->getAttribute('events');
     $time = $this->getArg('time', time(), FILTER_VALIDATE_INT);
     if ($event = $locationEvents->getItem($eventID, $time)) {
         $this->assign('event', $event);
     } else {
         throw new KurogoUserException($this->getLocalizedString('EVENT_NOT_FOUND'));
     }
     $eventFields = $this->getModuleSections('schedule-detail');
     $fields = array();
     foreach ($eventFields as $key => $info) {
         $field = array();
         $value = $event->get_attribute($key);
         if (empty($value)) {
             continue;
         }
         if (isset($info['label'])) {
             $field['label'] = $info['label'];
         }
         if (isset($info['class'])) {
             $field['class'] = $info['class'];
         }
         if (Kurogo::arrayVal($info, 'nl2br')) {
             $value = nl2br($value);
         }
         if (isset($info['type'])) {
             $field['title'] = $this->valueForType($info['type'], $value);
             $field['url'] = $this->urlForType($info['type'], $value);
         } elseif (isset($info['module'])) {
             $field = array_merge($field, Kurogo::moduleLinkForValue($info['module'], $value, $this, $event));
         } else {
             $field['title'] = $value;
         }
         $fields[] = $field;
     }
     $this->assign('fields', $fields);
 }
开发者ID:sponto,项目名称:msbm-mobile,代码行数:43,代码来源:DiningWebModule.php

示例5: formatDetailFieldInfo

 protected function formatDetailFieldInfo($value, $info, KurogoDataObject $object)
 {
     // if the value is empty then see if there is a ifBlankfield
     if (is_null($value) || is_string($value) && strlen($value) == 0) {
         if (isset($info['ifBlank'])) {
             $info['title'] = $info['ifBlank'];
             $info['titlefield'] = null;
         } else {
             return null;
         }
     }
     $type = Kurogo::arrayVal($info, 'type', 'text');
     if (is_array($value)) {
         if (isset($info['format'])) {
             $value = vsprintf($this->replaceFormat($info['format']), $value);
         } else {
             $delimiter = isset($info['delimiter']) ? $info['delimiter'] : ' ';
             $value = implode($delimiter, $value);
         }
     } elseif (is_object($value)) {
         if ($type == 'date') {
             if (!$value instanceof DateTime) {
                 throw new KurogoDataException("Date type must be an instance of DateTime");
             }
             $value = $value->format('U');
         } else {
             throw new KurogoDataException("Value is an object. This needs to be traced");
         }
     }
     $detail = $info;
     foreach (array('title', 'subtitle', 'label', 'url', 'class', 'img', 'listclass', 'imagealt', 'imageheight', 'imagewidth') as $attrib) {
         if (isset($info[$attrib . 'field'])) {
             $detail[$attrib] = $this->getObjectField($object, $info[$attrib . 'field']);
         }
     }
     if (!isset($detail['class'])) {
         $detail['class'] = '';
     }
     switch ($type) {
         case 'email':
             if (!isset($detail['title'])) {
                 $detail['title'] = str_replace('@', '@&shy;', $value);
             }
             $detail['url'] = "mailto:{$value}";
             $detail['class'] = trim(Kurogo::arrayVal($detail, 'class', '') . ' email');
             break;
         case 'phone':
             if (!isset($detail['title'])) {
                 $detail['title'] = str_replace('-', '-&shy;', $value);
             }
             if (strpos($value, '+1') !== 0) {
                 $value = "+1{$value}";
             }
             $detail['url'] = PhoneFormatter::getPhoneURL($value);
             $detail['class'] = trim(Kurogo::arrayVal($detail, 'class', '') . ' phone');
             break;
         case 'currency':
             if (!isset($detail['title'])) {
                 $detail['title'] = sprintf("\$%s", number_format($value, 2));
             }
             break;
         case 'date':
             if (!isset($detail['title'])) {
                 $format = Kurogo::arrayVal($detail, 'format', '%m/%d/%Y');
                 $detail['title'] = strftime($format, $value);
             }
             break;
         case 'text':
             if (!isset($detail['title'])) {
                 $detail['title'] = nl2br(trim($value));
             }
             break;
         case 'image':
             $url = $value;
             $alt = Kurogo::arrayVal($detail, 'imagealt');
             if ($height = Kurogo::arrayVal($detail, 'imageheight')) {
                 $height = sprintf('height="%d"', $height);
             }
             if ($width = Kurogo::arrayVal($detail, 'imagewidth')) {
                 $width = sprintf('width="%d"', $width);
             }
             if (!isset($detail['title'])) {
                 $detail['title'] = sprintf('<img src="%s" alt="%s" %s %s class="detailimage" />', $value, htmlentities($alt), $height, $width);
             }
             break;
         default:
             throw new KurogoConfigurationException("Unhandled type {$type}");
             break;
     }
     if (isset($info['module'])) {
         $modValue = $value;
         if (isset($info['value'])) {
             $modValue = $this->getObjectField($object, $info['value']);
         }
         $moduleLink = Kurogo::moduleLinkForValue($info['module'], $modValue, $this->module, $object);
         $detail = array_merge($moduleLink, $detail);
         $detail['class'] .= " " . Kurogo::arrayVal($moduleLink, 'class');
     } elseif (isset($info['page'])) {
         $pageValue = $value;
         if (isset($info['value'])) {
//.........这里部分代码省略.........
开发者ID:sponto,项目名称:msbm-mobile,代码行数:101,代码来源:DataObjectDetailsController.php

示例6: formatScheduleDetail

 protected function formatScheduleDetail(AthleticEvent $event)
 {
     $allFieldsValue = $this->getFieldsForSechedule($event);
     $showFields = $this->getModuleSections('schedule-detail');
     $fields = array();
     foreach ($showFields as $key => $info) {
         $field = array();
         if (!isset($allFieldsValue[$key]) || !$allFieldsValue[$key]) {
             continue;
         }
         $value = $allFieldsValue[$key];
         if (isset($info['label'])) {
             $field['label'] = $info['label'];
         }
         if (isset($info['class'])) {
             $field['class'] = $info['class'];
         }
         if (isset($info['type'])) {
             $field['title'] = $this->valueForType($info['type'], $value, $event);
             $field['url'] = $this->urlForType($info['type'], $value);
         } elseif (isset($info['module'])) {
             $field = array_merge($field, Kurogo::moduleLinkForValue($info['module'], $value, $this, $event));
         } else {
             $field['title'] = nl2br($value);
         }
         $fields[] = $field;
     }
     return $fields;
 }
开发者ID:nncsang,项目名称:Kurogo,代码行数:29,代码来源:AthleticsWebModule.php


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