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


PHP url::convert_uploaded_to_abs方法代码示例

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


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

示例1: block

 public function block()
 {
     $content = new View('blocks/media_block');
     // Get Reports
     // XXX: Might need to replace magic no. 8 with a constant
     $content->total_items = ORM::factory('incident')->where('incident_active', '1')->limit('8')->count_all();
     $incidents = ORM::factory('incident')->where('incident_active', '1')->limit('10')->orderby('incident_date', 'desc')->find_all();
     $incident_video = array();
     $incident_photo = array();
     foreach ($incidents as $incident) {
         $incident_video[$incident->id] = array();
         $incident_photo[$incident->id] = array();
         foreach ($incident->media as $media) {
             // We only care about videos and photos
             if ($media->media_type == 2) {
                 $incident_video[$incident->id][] = array('link' => $media->media_link, 'thumb' => $media->media_thumb);
             } elseif ($media->media_type == 1) {
                 $incident_photo[$incident->id][] = array('large' => url::convert_uploaded_to_abs($media->media_link), 'thumb' => url::convert_uploaded_to_abs($media->media_thumb));
             }
         }
     }
     // Video & photo links
     $content->incident_videos = $incident_video;
     $content->incident_photos = $incident_photo;
     $content->incidents = $incidents;
     // Create object of the video embed class
     $content->video_embed = new VideoEmbed();
     echo $content;
 }
开发者ID:rjmackay,项目名称:Ushahidi-plugin-media-block,代码行数:29,代码来源:register_media_blocks.php

示例2: users_badges

 /**
  * Returns an array of badges for a specific user
  * @return array
  */
 public static function users_badges($user_id)
 {
     // Get assigned badge ids
     $assigned_badges = ORM::factory('badge_user')->where(array('user_id' => $user_id))->find_all();
     $assigned = array();
     foreach ($assigned_badges as $assigned_badge) {
         $assigned[] = $assigned_badge->badge_id;
     }
     $arr = array();
     if (count($assigned) > 0) {
         // Get badges with those ids
         $badges = ORM::factory('badge')->in('id', $assigned)->find_all();
         foreach ($badges as $badge) {
             $arr[$badge->id] = array('id' => $badge->id, 'name' => $badge->name, 'description' => $badge->description, 'img' => url::convert_uploaded_to_abs($badge->media->media_link), 'img_m' => url::convert_uploaded_to_abs($badge->media->media_medium), 'img_t' => url::convert_uploaded_to_abs($badge->media->media_thumb));
         }
     }
     return $arr;
 }
开发者ID:Dirichi,项目名称:Ushahidi_Web,代码行数:22,代码来源:badge.php

示例3: markers_geojson

 /**
  * Generate GEOJSON from incidents
  * 
  * @param ORM_Iterator|Database_Result|array $incidents collection of incidents
  * @param int $category_id
  * @param string $color
  * @param string $icon
  * @return array $json_features geojson features array
  **/
 protected function markers_geojson($incidents, $category_id, $color, $icon, $include_geometries = TRUE)
 {
     $json_features = array();
     // Extra params for markers only
     // Get the incidentid (to be added as first marker)
     $first_incident_id = (isset($_GET['i']) and intval($_GET['i']) > 0) ? intval($_GET['i']) : 0;
     $media_type = (isset($_GET['m']) and intval($_GET['m']) > 0) ? intval($_GET['m']) : 0;
     foreach ($incidents as $marker) {
         // Handle both reports::fetch_incidents() response and actual ORM objects
         $marker->id = isset($marker->incident_id) ? $marker->incident_id : $marker->id;
         if (isset($marker->latitude) and isset($marker->longitude)) {
             $latitude = $marker->latitude;
             $longitude = $marker->longitude;
         } elseif (isset($marker->location) and isset($marker->location->latitude) and isset($marker->location->longitude)) {
             $latitude = $marker->location->latitude;
             $longitude = $marker->location->longitude;
         } else {
             // No location - skip this report
             continue;
         }
         // Get thumbnail
         $thumb = "";
         $media = ORM::factory('incident', $marker->id)->media;
         if ($media->count()) {
             foreach ($media as $photo) {
                 if ($photo->media_thumb) {
                     // Get the first thumb
                     $thumb = url::convert_uploaded_to_abs($photo->media_thumb);
                     break;
                 }
             }
         }
         // Get URL from object, fallback to Incident_Model::get() if object doesn't have url or url()
         if (method_exists($marker, 'url')) {
             $link = $marker->url();
         } elseif (isset($marker->url)) {
             $link = $marker->url;
         } else {
             $link = Incident_Model::get_url($marker);
         }
         $item_name = $this->get_title($marker->incident_title, $link);
         $json_item = array();
         $json_item['type'] = 'Feature';
         $json_item['properties'] = array('id' => $marker->id, 'name' => $item_name, 'link' => $link, 'category' => array($category_id), 'color' => $color, 'icon' => $icon, 'thumb' => $thumb, 'timestamp' => strtotime($marker->incident_date), 'count' => 1, 'class' => get_class($marker), 'title' => $marker->incident_title);
         $json_item['geometry'] = array('type' => 'Point', 'coordinates' => array($longitude, $latitude));
         if ($marker->id == $first_incident_id) {
             array_unshift($json_features, $json_item);
         } else {
             array_push($json_features, $json_item);
         }
         // Get Incident Geometries
         if ($include_geometries) {
             $geometry = $this->get_geometry($marker->id, $marker->incident_title, $marker->incident_date, $link);
             if (count($geometry)) {
                 foreach ($geometry as $g) {
                     array_push($json_features, $g);
                 }
             }
         }
     }
     Event::run('ushahidi_filter.json_index_features', $json_features);
     return $json_features;
 }
开发者ID:niiyatii,项目名称:crowdmap,代码行数:72,代码来源:json.php

示例4: foreach

</span>
			<?php 
Event::run('ushahidi_action.report_meta_after_time', $incident_id);
?>
		</p>

		<div class="report-category-list">
		<p>
			<?php 
foreach ($incident_category as $category) {
    // don't show hidden categoies
    if ($category->category->category_visible == 0) {
        continue;
    }
    if ($category->category->category_image_thumb) {
        $style = "background:transparent url(" . url::convert_uploaded_to_abs($category->category->category_image_thumb) . ") 0 0 no-repeat";
    } else {
        $style = "background-color:#" . $category->category->category_color;
    }
    ?>
					<a href="<?php 
    echo url::site() . "reports/?c=" . $category->category->id;
    ?>
" title="<?php 
    echo Category_Lang_Model::category_description($category->category_id);
    ?>
">
						<span class="r_cat-box" style="<?php 
    echo $style;
    ?>
">&nbsp;</span>
开发者ID:Dirichi,项目名称:Ushahidi_Web,代码行数:31,代码来源:detail.php

示例5: index

 public function index()
 {
     $this->template->header->this_page = 'home';
     $this->template->content = new View('main/layout');
     // Cacheable Main Controller
     $this->is_cachable = TRUE;
     // Map and Slider Blocks
     $div_map = new View('main/map');
     $div_timeline = new View('main/timeline');
     // Filter::map_main - Modify Main Map Block
     Event::run('ushahidi_filter.map_main', $div_map);
     // Filter::map_timeline - Modify Main Map Block
     Event::run('ushahidi_filter.map_timeline', $div_timeline);
     $this->template->content->div_map = $div_map;
     $this->template->content->div_timeline = $div_timeline;
     // Check if there is a site message
     $this->template->content->site_message = '';
     $site_message = trim(Kohana::config('settings.site_message'));
     if ($site_message != '') {
         // Send the site message to both the header and the main content body
         //   so a theme can utilize it in either spot.
         $this->template->content->site_message = $site_message;
         $this->template->header->site_message = $site_message;
     }
     // Get locale
     $l = Kohana::config('locale.language.0');
     // Get all active top level categories
     $parent_categories = array();
     $all_parents = ORM::factory('category')->where('category_visible', '1')->where('parent_id', '0')->find_all();
     foreach ($all_parents as $category) {
         // Get The Children
         $children = array();
         foreach ($category->children as $child) {
             $child_visible = $child->category_visible;
             if ($child_visible) {
                 // Check for localization of child category
                 $display_title = Category_Lang_Model::category_title($child->id, $l);
                 $ca_img = $child->category_image != NULL ? url::convert_uploaded_to_abs($child->category_image) : NULL;
                 $children[$child->id] = array($display_title, $child->category_color, $ca_img);
             }
         }
         // Check for localization of parent category
         $display_title = Category_Lang_Model::category_title($category->id, $l);
         // Put it all together
         $ca_img = $category->category_image != NULL ? url::convert_uploaded_to_abs($category->category_image) : NULL;
         $parent_categories[$category->id] = array($display_title, $category->category_color, $ca_img, $children);
     }
     $this->template->content->categories = $parent_categories;
     // Get all active Layers (KMZ/KML)
     $layers = array();
     $config_layers = Kohana::config('map.layers');
     // use config/map layers if set
     if ($config_layers == $layers) {
         foreach (ORM::factory('layer')->where('layer_visible', 1)->find_all() as $layer) {
             $layers[$layer->id] = array($layer->layer_name, $layer->layer_color, $layer->layer_url, $layer->layer_file);
         }
     } else {
         $layers = $config_layers;
     }
     $this->template->content->layers = $layers;
     // Get Default Color
     $this->template->content->default_map_all = Kohana::config('settings.default_map_all');
     // Get default icon
     $this->template->content->default_map_all_icon = '';
     if (Kohana::config('settings.default_map_all_icon_id')) {
         $icon_object = ORM::factory('media')->find(Kohana::config('settings.default_map_all_icon_id'));
         $this->template->content->default_map_all_icon = Kohana::config('upload.relative_directory') . "/" . $icon_object->media_medium;
     }
     // Get Twitter Hashtags
     $this->template->content->twitter_hashtag_array = array_filter(array_map('trim', explode(',', Kohana::config('settings.twitter_hashtags'))));
     // Get Report-To-Email
     $this->template->content->report_email = Kohana::config('settings.site_email');
     // Get SMS Numbers
     $phone_array = array();
     $sms_no1 = Kohana::config('settings.sms_no1');
     $sms_no2 = Kohana::config('settings.sms_no2');
     $sms_no3 = Kohana::config('settings.sms_no3');
     if (!empty($sms_no1)) {
         $phone_array[] = $sms_no1;
     }
     if (!empty($sms_no2)) {
         $phone_array[] = $sms_no2;
     }
     if (!empty($sms_no3)) {
         $phone_array[] = $sms_no3;
     }
     $this->template->content->phone_array = $phone_array;
     // Get external apps
     $external_apps = array();
     // Catch errors, in case we have an old db
     try {
         $external_apps = ORM::factory('externalapp')->find_all();
     } catch (Exception $e) {
     }
     $this->template->content->external_apps = $external_apps;
     // Get The START, END and Incident Dates
     $startDate = "";
     $endDate = "";
     $display_startDate = 0;
     $display_endDate = 0;
//.........这里部分代码省略.........
开发者ID:rjmackay,项目名称:Ushahidi_Web,代码行数:101,代码来源:main.php

示例6: index

 public function index()
 {
     $this->template->header->this_page = 'home';
     $this->template->content = new View('main');
     // Cacheable Main Controller
     $this->is_cachable = TRUE;
     // Map and Slider Blocks
     $div_map = new View('main_map');
     $div_timeline = new View('main_timeline');
     // Filter::map_main - Modify Main Map Block
     Event::run('ushahidi_filter.map_main', $div_map);
     // Filter::map_timeline - Modify Main Map Block
     Event::run('ushahidi_filter.map_timeline', $div_timeline);
     $this->template->content->div_map = $div_map;
     $this->template->content->div_timeline = $div_timeline;
     // Check if there is a site message
     $this->template->content->site_message = '';
     $site_message = trim(Kohana::config('settings.site_message'));
     if ($site_message != '') {
         $this->template->content->site_message = $site_message;
     }
     // Get locale
     $l = Kohana::config('locale.language.0');
     // Get all active top level categories
     $parent_categories = array();
     foreach (ORM::factory('category')->where('category_visible', '1')->where('parent_id', '0')->orderby('category_position', 'asc')->find_all() as $category) {
         // Get The Children
         $children = array();
         foreach ($category->orderby('category_position', 'asc')->children as $child) {
             $child_visible = $child->category_visible;
             if ($child_visible) {
                 // Check for localization of child category
                 $display_title = Category_Lang_Model::category_title($child->id, $l);
                 $ca_img = $child->category_image != NULL ? url::convert_uploaded_to_abs($child->category_image) : NULL;
                 $children[$child->id] = array($display_title, $child->category_color, $ca_img);
                 if ($child->category_trusted) {
                     // Get Trusted Category Count
                     $trusted = $this->get_trusted_category_count($child->id);
                     if (!$trusted->count_all()) {
                         unset($children[$child->id]);
                     }
                 }
             }
         }
         // Check for localization of parent category
         $display_title = Category_Lang_Model::category_title($category->id, $l);
         // Put it all together
         $ca_img = $category->category_image != NULL ? url::convert_uploaded_to_abs($category->category_image) : NULL;
         $parent_categories[$category->id] = array($display_title, $category->category_color, $ca_img, $children);
         if ($category->category_trusted) {
             // Get Trusted Category Count
             $trusted = $this->get_trusted_category_count($category->id);
             if (!$trusted->count_all()) {
                 unset($parent_categories[$category->id]);
             }
         }
     }
     $this->template->content->categories = $parent_categories;
     // Get all active Layers (KMZ/KML)
     $layers = array();
     $config_layers = Kohana::config('map.layers');
     // use config/map layers if set
     if ($config_layers == $layers) {
         foreach (ORM::factory('layer')->where('layer_visible', 1)->find_all() as $layer) {
             $layers[$layer->id] = array($layer->layer_name, $layer->layer_color, $layer->layer_url, $layer->layer_file);
         }
     } else {
         $layers = $config_layers;
     }
     $this->template->content->layers = $layers;
     // Get all active Shares
     $shares = array();
     foreach (ORM::factory('sharing')->where('sharing_active', 1)->find_all() as $share) {
         $shares[$share->id] = array($share->sharing_name, $share->sharing_color);
     }
     $this->template->content->shares = $shares;
     // Get Default Color
     $this->template->content->default_map_all = Kohana::config('settings.default_map_all');
     // Get Twitter Hashtags
     $this->template->content->twitter_hashtag_array = array_filter(array_map('trim', explode(',', Kohana::config('settings.twitter_hashtags'))));
     // Get Report-To-Email
     $this->template->content->report_email = Kohana::config('settings.site_email');
     // Get SMS Numbers
     $phone_array = array();
     $sms_no1 = Kohana::config('settings.sms_no1');
     $sms_no2 = Kohana::config('settings.sms_no2');
     $sms_no3 = Kohana::config('settings.sms_no3');
     if (!empty($sms_no1)) {
         $phone_array[] = $sms_no1;
     }
     if (!empty($sms_no2)) {
         $phone_array[] = $sms_no2;
     }
     if (!empty($sms_no3)) {
         $phone_array[] = $sms_no3;
     }
     $this->template->content->phone_array = $phone_array;
     // Get The START, END and Incident Dates
     $startDate = "";
     $endDate = "";
//.........这里部分代码省略.........
开发者ID:neumicro,项目名称:Ushahidi_Web_Dev,代码行数:101,代码来源:main.php

示例7: _get_incidents

 /**
  * Generic function to get reports by given set of parameters
  *
  * @param string $where SQL where clause
  * @return string XML or JSON string
  */
 public function _get_incidents($where = array())
 {
     // STEP 1.
     // Get the incidents
     $items = Incident_Model::get_incidents($where, $this->list_limit, $this->order_field, $this->sort);
     //No record found.
     if ($items->count() == 0) {
         return $this->response(4, $this->error_messages);
     }
     // Records found - proceed
     // Set the no. of records returned
     $this->record_count = $items->count();
     // Will hold the XML/JSON string to return
     $ret_json_or_xml = '';
     $json_reports = array();
     $json_report_media = array();
     $json_report_categories = array();
     $json_incident_media = array();
     $upload_path = str_replace("media/uploads/", "", Kohana::config('upload.relative_directory') . "/");
     //XML elements
     $xml = new XmlWriter();
     $xml->openMemory();
     $xml->startDocument('1.0', 'UTF-8');
     $xml->startElement('response');
     $xml->startElement('payload');
     $xml->writeElement('domain', $this->domain);
     $xml->startElement('incidents');
     // Records found, proceed
     // Store the incident ids
     $incidents_ids = array();
     $custom_field_items = array();
     foreach ($items as $item) {
         $incident_ids[] = $item->incident_id;
         $thiscustomfields = customforms::get_custom_form_fields($item->incident_id, null, false, "view");
         if (!empty($thiscustomfields)) {
             $custom_field_items[$item->incident_id] = $thiscustomfields;
         }
     }
     //
     // STEP 2.
     // Fetch the incident categories
     //
     // Execute the query
     $incident_categories = ORM::factory('category')->select('category.*, incident_category.incident_id')->join('incident_category', 'category.id', 'incident_category.category_id')->in('incident_category.incident_id', $incident_ids)->find_all();
     // To hold the incident category items
     $category_items = array();
     // Fetch items into array
     foreach ($incident_categories as $incident_category) {
         $category_items[$incident_category->incident_id][] = $incident_category->as_array();
     }
     // Free temporary variables from memory
     unset($incident_categories);
     //
     // STEP 3.
     // Fetch the media associated with all the incidents
     //
     $media_items_result = ORM::factory('media')->in('incident_id', $incident_ids)->find_all();
     // To store the fetched media items
     $media_items = array();
     // Fetch items into array
     foreach ($media_items_result as $media_item) {
         $media_item_array = $media_item->as_array();
         if ($media_item->media_type == 1 and !empty($media_item->media_thumb)) {
             $media_item_array["media_thumb_url"] = url::convert_uploaded_to_abs($media_item->media_thumb);
             $media_item_array["media_link_url"] = url::convert_uploaded_to_abs($media_item->media_link);
         }
         $media_items[$media_item->incident_id][] = $media_item_array;
     }
     // Free temporary variables
     unset($media_items_result, $media_item_array);
     //
     // STEP 4.
     // Fetch the comments associated with the incidents
     //
     if ($this->comments) {
         // Execute the query
         $incident_comments = ORM::factory('comment')->in('incident_id', $incident_ids)->where('comment_spam', 0)->find_all();
         // To hold the incident category items
         $comment_items = array();
         // Fetch items into array
         foreach ($incident_comments as $incident_comment) {
             $comment_items[$incident_comment->incident_id][] = $incident_comment->as_array();
         }
         // Free temporary variables from memory
         unset($incident_comments);
     }
     //
     // STEP 5.
     // Return XML
     //
     foreach ($items as $item) {
         // Build xml file
         $xml->startElement('incident');
         $xml->writeElement('id', $item->incident_id);
//.........这里部分代码省略.........
开发者ID:Dirichi,项目名称:Ushahidi_Web,代码行数:101,代码来源:MY_Incidents_Api_Object.php

示例8: foreach

        $category_image = $category_info[2] != NULL ? url::convert_uploaded_to_abs($category_info[2]) : NULL;
        $category_description = html::escape(Category_Lang_Model::category_description($category));
        $color_css = 'class="category-icon swatch" style="background-color:#' . $category_color . '"';
        if ($category_info[2] != NULL) {
            $category_image = html::image(array('src' => $category_image));
            $color_css = 'class="category-icon"';
        }
        echo '<li>' . '<a href="#" id="cat_' . $category . '" title="' . $category_description . '">' . '<span ' . $color_css . '>' . $category_image . '</span>' . '<span class="category-title">' . $category_title . '</span>' . '</a>';
        // Get Children
        echo '<div class="hide" id="child_' . $category . '">';
        if (sizeof($category_info[3]) != 0) {
            echo '<ul>';
            foreach ($category_info[3] as $child => $child_info) {
                $child_title = html::escape($child_info[0]);
                $child_color = $child_info[1];
                $child_image = $child_info[2] != NULL ? url::convert_uploaded_to_abs($child_info[2]) : NULL;
                $child_description = html::escape(Category_Lang_Model::category_description($child));
                $color_css = 'class="category-icon swatch" style="background-color:#' . $child_color . '"';
                if ($child_info[2] != NULL) {
                    $child_image = html::image(array('src' => $child_image));
                    $color_css = 'class="category-icon"';
                }
                echo '<li>' . '<a href="#" id="cat_' . $child . '" title="' . $child_description . '">' . '<span ' . $color_css . '>' . $child_image . '</span>' . '<span class="category-title">' . $child_title . '</span>' . '</a>' . '</li>';
            }
            echo '</ul>';
        }
        echo '</div></li>';
    }
    ?>
			</ul>
			<?php 
开发者ID:niiyatii,项目名称:crowdmap,代码行数:31,代码来源:layout.php

示例9: foreach

    ?>
			<div><?php 
    echo Kohana::lang('ui_main.no_reports');
    ?>
</div>
			<?php 
}
$i = 0;
foreach ($incidents as $incident) {
    $incident_id = $incident->id;
    $incident_title = text::limit_chars($incident->incident_title, 40, '...', True);
    $incident_date = $incident->incident_date;
    $incident_date = date('j M Y', strtotime($incident->incident_date));
    $incident_category = $incident->category->current() ? $incident->category->current()->category_title : '';
    if (isset($incident->media_thumb)) {
        $incident_video = url::convert_uploaded_to_abs($incident->media_thumb);
        ?>
		<div class="report <?php 
        echo "col-" . $i % 5;
        ?>
">
			<a href="<?php 
        echo url::site() . 'reports/view/' . $incident_id;
        ?>
"> 
			<div class="report-image"><img src="<?php 
        echo $incident_video;
        ?>
" width="160" /></div>
			<div  class="report-date"><?php 
        echo $incident_date;
开发者ID:rjmackay,项目名称:Ushahidi-tedx-theme,代码行数:31,代码来源:tedx_recent_reports.php

示例10: markers_geojson

 /**
  * Generate GEOJSON from incidents
  * 
  * @param ORM_Iterator|Database_Result|array $incidents collection of incidents
  * @param int $category_id
  * @param string $color
  * @param string $icon
  * @return array $json_features geojson features array
  **/
 protected function markers_geojson($incidents, $category_id, $color, $icon, $include_geometries = TRUE)
 {
     $json_features = array();
     // Extra params for markers only
     // Get the incidentid (to be added as first marker)
     $first_incident_id = (isset($_GET['i']) and intval($_GET['i']) > 0) ? intval($_GET['i']) : 0;
     $media_type = (isset($_GET['m']) and intval($_GET['m']) > 0) ? intval($_GET['m']) : 0;
     $incident_model = new Incident_Model();
     $all_categories = $incident_model::get_active_categories();
     foreach ($incidents as $marker) {
         // Handle both reports::fetch_incidents() response and actual ORM objects
         $marker->id = isset($marker->incident_id) ? $marker->incident_id : $marker->id;
         if (isset($marker->latitude) and isset($marker->longitude)) {
             $latitude = $marker->latitude;
             $longitude = $marker->longitude;
         } elseif (isset($marker->location) and isset($marker->location->latitude) and isset($marker->location->longitude)) {
             $latitude = $marker->location->latitude;
             $longitude = $marker->location->longitude;
         } else {
             // No location - skip this report
             continue;
         }
         // Get thumbnail
         $thumb = "";
         $media = ORM::factory('incident', $marker->id)->media;
         //Invisible Cities customisation
         //Requires to uncluster markers and present them in their category color
         // get category for incident, we only visualise the first category present in the incident - gotcha but ok
         $incident_category_result = ORM::factory('incident_category')->where(array('incident_id' => $marker->id))->find();
         if (array_key_exists($incident_category_result->category_id, $all_categories)) {
             //get category details
             $category_details = $all_categories[$incident_category_result->category_id];
             //get the color
             $color = $category_details[1];
         }
         //code for debugging
         // $categories = array();
         // foreach ($incident_categories_result as $category) {
         // 	// $category_details = ORM::factory('category', $category->category_id);
         // 	$category_details = $all_categories[$category->category_id];
         // 	$color = $category_details[1];
         // 	array_push($categories, array(
         // 		'category_id' => $category->category_id,
         // 		'color' => $category_details[1]
         // 		));
         // }
         if ($media->count()) {
             foreach ($media as $photo) {
                 if ($photo->media_thumb) {
                     // Get the first thumb
                     $thumb = url::convert_uploaded_to_abs($photo->media_thumb);
                     break;
                 }
             }
         }
         // Get URL from object, fallback to Incident_Model::get() if object doesn't have url or url()
         if (method_exists($marker, 'url')) {
             $link = $marker->url();
         } elseif (isset($marker->url)) {
             $link = $marker->url;
         } else {
             $link = Incident_Model::get_url($marker);
         }
         $item_name = $this->get_title($marker->incident_title, $link);
         $json_item = array();
         $json_item['type'] = 'Feature';
         $json_item['properties'] = array('id' => $marker->id, 'name' => $item_name, 'link' => $link, 'category' => array($category_id), 'color' => $color, 'icon' => $icon, 'thumb' => $thumb, 'timestamp' => strtotime($marker->incident_date), 'count' => 1, 'class' => get_class($marker), 'title' => $marker->incident_title);
         $json_item['geometry'] = array('type' => 'Point', 'coordinates' => array((double) $longitude, (double) $latitude));
         if ($marker->id == $first_incident_id) {
             array_unshift($json_features, $json_item);
         } else {
             array_push($json_features, $json_item);
         }
         // Get Incident Geometries
         if ($include_geometries) {
             $geometry = $this->get_geometry($marker->id, $marker->incident_title, $marker->incident_date, $link);
             if (count($geometry)) {
                 foreach ($geometry as $g) {
                     array_push($json_features, $g);
                 }
             }
         }
     }
     Event::run('ushahidi_filter.json_index_features', $json_features);
     return $json_features;
 }
开发者ID:uws-eresearch,项目名称:invisiblecity-ushahidi,代码行数:95,代码来源:json.php

示例11: site


//.........这里部分代码省略.........
                     $m_name = $new_filename . "_m" . $file_type;
                     Image::factory($filename)->resize(80, 80, Image::HEIGHT)->save(Kohana::config('upload.directory', TRUE) . $m_name);
                     // Thumbnail
                     $t_name = $new_filename . "_t" . $file_type;
                     Image::factory($filename)->resize(60, 60, Image::HEIGHT)->save(Kohana::config('upload.directory', TRUE) . $t_name);
                     // Name the files for the DB
                     $media_link = $l_name;
                     $media_medium = $m_name;
                     $media_thumb = $t_name;
                     // Okay, now we have these three different files on the server, now check to see
                     //   if we should be dropping them on the CDN
                     if (Kohana::config("cdn.cdn_store_dynamic_content")) {
                         $media_link = cdn::upload($media_link);
                         $media_medium = cdn::upload($media_medium);
                         $media_thumb = cdn::upload($media_thumb);
                         // We no longer need the files we created on the server. Remove them.
                         $local_directory = rtrim(Kohana::config('upload.directory', TRUE), '/') . '/';
                         unlink($local_directory . $l_name);
                         unlink($local_directory . $m_name);
                         unlink($local_directory . $t_name);
                     }
                     // Remove the temporary file
                     unlink($filename);
                     // Save banner image in the media table
                     $media = new Media_Model();
                     $media->media_type = 1;
                     // Image
                     $media->media_link = $media_link;
                     $media->media_medium = $media_medium;
                     $media->media_thumb = $media_thumb;
                     $media->media_date = date("Y-m-d H:i:s", time());
                     $media->save();
                     // Save new banner image in settings
                     $settings = new Settings_Model(1);
                     $settings->site_banner_id = $media->id;
                     $settings->save();
                 }
             }
             // Delete Settings Cache
             $this->cache->delete('settings');
             $this->cache->delete_tag('settings');
             // Everything is A-Okay!
             $form_saved = TRUE;
             // Action::site_settings_modified - Site settings have changed
             Event::run('ushahidi_action.site_settings_modified');
             // repopulate the form fields
             $form = arr::overwrite($form, $post->as_array());
         } else {
             // repopulate the form fields
             $form = arr::overwrite($form, $post->as_array());
             // populate the error fields, if any
             if (is_array($files->errors()) and count($files->errors()) > 0) {
                 // Error with file upload
                 $errors = arr::overwrite($errors, $files->errors('settings'));
             } else {
                 // Error with other form filed
                 $errors = arr::overwrite($errors, $post->errors('settings'));
             }
             $form_error = TRUE;
         }
     } else {
         $form = array('site_name' => $settings->site_name, 'site_tagline' => $settings->site_tagline, 'site_banner_id' => $settings->site_banner_id, 'site_email' => $settings->site_email, 'alerts_email' => $settings->alerts_email, 'site_message' => $settings->site_message, 'site_copyright_statement' => $settings->site_copyright_statement, 'site_submit_report_message' => $settings->site_submit_report_message, 'site_language' => $settings->site_language, 'site_timezone' => $settings->site_timezone, 'site_contact_page' => $settings->site_contact_page, 'items_per_page' => $settings->items_per_page, 'items_per_page_admin' => $settings->items_per_page_admin, 'blocks_per_row' => $settings->blocks_per_row, 'allow_alerts' => $settings->allow_alerts, 'allow_reports' => $settings->allow_reports, 'allow_comments' => $settings->allow_comments, 'allow_feed' => $settings->allow_feed, 'allow_stat_sharing' => $settings->allow_stat_sharing, 'allow_clustering' => $settings->allow_clustering, 'cache_pages' => $settings->cache_pages, 'cache_pages_lifetime' => $settings->cache_pages_lifetime, 'private_deployment' => $settings->private_deployment, 'checkins' => $settings->checkins, 'default_map_all' => $settings->default_map_all, 'google_analytics' => $settings->google_analytics, 'twitter_hashtags' => $settings->twitter_hashtags, 'api_akismet' => $settings->api_akismet);
     }
     // Get banner image
     if ($settings->site_banner_id != NULL) {
         $banner = ORM::factory('media')->find($settings->site_banner_id);
         $this->template->content->banner = url::convert_uploaded_to_abs($banner->media_link);
         $this->template->content->banner_m = url::convert_uploaded_to_abs($banner->media_medium);
         $this->template->content->banner_t = url::convert_uploaded_to_abs($banner->media_thumb);
     } else {
         $this->template->content->banner = NULL;
         $this->template->content->banner_m = NULL;
         $this->template->content->banner_t = NULL;
     }
     $this->template->colorpicker_enabled = TRUE;
     $this->template->content->form = $form;
     $this->template->content->errors = $errors;
     $this->template->content->form_error = $form_error;
     $this->template->content->form_saved = $form_saved;
     $this->template->content->items_per_page_array = array('10' => '10 Items', '20' => '20 Items', '30' => '30 Items', '50' => '50 Items');
     $blocks_per_row_array = array();
     for ($i = 1; $i <= 21; $i++) {
         $blocks_per_row_array[$i] = $i;
     }
     $this->template->content->blocks_per_row_array = $blocks_per_row_array;
     $this->template->content->yesno_array = array('1' => strtoupper(Kohana::lang('ui_main.yes')), '0' => strtoupper(Kohana::lang('ui_main.no')));
     $this->template->content->comments_array = array('1' => strtoupper(Kohana::lang('ui_main.yes') . " - " . Kohana::lang('ui_admin.approve_auto')), '2' => strtoupper(Kohana::lang('ui_main.yes') . " - " . Kohana::lang('ui_admin.approve_manual')), '0' => strtoupper(Kohana::lang('ui_main.no')));
     $this->template->content->cache_pages_lifetime_array = array('300' => '5 ' . Kohana::lang('ui_admin.minutes'), '600' => '10 ' . Kohana::lang('ui_admin.minutes'), '900' => '15 ' . Kohana::lang('ui_admin.minutes'), '1800' => '30 ' . Kohana::lang('ui_admin.minutes'));
     //Generate all timezones
     $site_timezone_array = array();
     $site_timezone_array[0] = Kohana::lang('ui_admin.server_time');
     foreach (timezone_identifiers_list() as $timezone) {
         $site_timezone_array[$timezone] = $timezone;
     }
     $this->template->content->site_timezone_array = $site_timezone_array;
     // Generate Available Locales
     $locales = locale::get_i18n();
     $this->template->content->locales_array = $locales;
     $this->cache->set('locales', $locales, array('locales'), 604800);
 }
开发者ID:neumicro,项目名称:Ushahidi_Web_Dev,代码行数:101,代码来源:settings.php

示例12: add_data_to_category

 private function add_data_to_category($category_array)
 {
     if ($category_array['parent_id']) {
         $category_array['parent_id'] = array($category_array['parent_id'] => array('api_url' => url::site(rest_controller::$api_base_url . '/categories/' . $category_array['parent_id'])));
     }
     $category_array['api_url'] = url::site(rest_controller::$api_base_url . '/categories/' . $category_array['id']);
     $category_array['category_image'] = $category_array['category_image'] ? url::convert_uploaded_to_abs($category_array['category_image']) : $category_array['category_image'];
     $category_array['category_image_thumb'] = $category_array['category_image_thumb'] ? url::convert_uploaded_to_abs($category_array['category_image_thumb']) : $category_array['category_image_thumb'];
     // No date attached to categories so always now
     $category_array['updated_at'] = date_create()->format(DateTime::W3C);
     return $category_array;
 }
开发者ID:rjmackay,项目名称:Ushahidi-plugin-restapiv2,代码行数:12,代码来源:categories.php

示例13: gather_checkins

 public function gather_checkins($id, $user_id, $mobileid, $mapdata)
 {
     $data = array();
     if ($mobileid != '') {
         $find_user = ORM::factory('user_devices')->find($mobileid);
         $user_id = $find_user->user_id;
     }
     if ($user_id == '') {
         $where_user_id = array('checkin.user_id !=' => '-1');
     } else {
         $where_user_id = array('checkin.user_id' => $user_id);
     }
     if ($id == '') {
         $where_id = array('checkin.id !=' => '-1');
     } else {
         $where_id = array('checkin.id' => $id);
     }
     $orderby = 'checkin.id';
     if (isset($this->request['orderby'])) {
         $orderby = $this->request['orderby'];
     }
     $sort = 'ASC';
     if (isset($this->request['sort'])) {
         $sort = $this->request['sort'];
     }
     $since_id = 0;
     if (isset($this->request['sinceid'])) {
         $since_id = $this->request['sinceid'];
     }
     //echo $this->request['sqllimit'];
     $limit = 20;
     if (isset($this->request['sqllimit'])) {
         $limit = $this->request['sqllimit'];
     }
     $offset = 0;
     if (isset($this->request['sqloffset'])) {
         $offset = $this->request['sqloffset'];
     }
     $checkins = ORM::factory('checkin')->select('DISTINCT checkin.*')->where($where_id)->where($where_user_id)->where('checkin.id >=', $since_id)->with('user')->with('location')->orderby($orderby, $sort)->find_all($limit, $offset);
     $seen_latest_ci = array();
     $users_names = array();
     $i = 0;
     foreach ($checkins as $checkin) {
         $data["checkins"][$i] = array("id" => $checkin->id, "user" => array("id" => $checkin->user_id, "username" => $checkin->user->username, "name" => $checkin->user->name, "color" => $checkin->user->color), "loc" => $checkin->location_id, "msg" => $checkin->checkin_description, "date" => $checkin->checkin_date, "lat" => $checkin->location->latitude, "lon" => $checkin->location->longitude);
         $j = 0;
         foreach ($checkin->media as $media) {
             $data["checkins"][$i]['media'][(int) $j] = array("id" => $media->id, "type" => $media->media_type, "link" => url::convert_uploaded_to_abs($media->media_link), "medium" => url::convert_uploaded_to_abs($media->media_medium), "thumb" => url::convert_uploaded_to_abs($media->media_thumb));
             $j++;
         }
         $j = 0;
         foreach ($checkin->comment as $comment) {
             if ($comment->user_id != 0) {
                 $author = $comment->user->name;
                 $email = $comment->user->email;
                 $username = $comment->user->username;
             } else {
                 $author = $comment->comment_author;
                 $email = $comment->comment_email;
                 $username = '';
             }
             $data["checkins"][$i]['comments'][(int) $j] = array("id" => $comment->id, "user_id" => $comment->user_id, "author" => $author, "email" => $email, "username" => $username, "description" => $comment->comment_description, "date" => $comment->comment_date);
             $j++;
         }
         // If we are displaying some extra map data...
         if ($mapdata != '') {
             if (!isset($seen_latest_ci[$checkin->user_id])) {
                 $opacity = 1;
             } else {
                 $opacity = 0.5;
             }
             $seen_latest_ci[$checkin->user_id] = $checkin->user_id;
             $data["checkins"][$i]['opacity'] = $opacity;
         }
         $i++;
     }
     // foreach ($users_names as $user_data)
     // {
     // 	$data["users"][] = $user_data;
     // }
     return $data;
 }
开发者ID:nanangsyaifudin,项目名称:HAC-2012,代码行数:81,代码来源:MY_Checkin_Api_Object.php

示例14: foreach

    // Why they feel this way and how they would change it are custom form fields
    $why_feel = '';
    $change_place = '';
    $custom_data = customforms::get_custom_form_fields($incident_id);
    foreach ($custom_data as $custom) {
        switch ($custom['field_id']) {
            case '1':
                $why_feel = text::limit_chars(html::strip_tags($custom['field_response']), 100, '...', True);
            case '2':
                $change_place = text::limit_chars(html::strip_tags($custom['field_response']), 100, '...', True);
        }
    }
    $incident_image = false;
    foreach ($incident->media as $media) {
        if ($media->media_type == 1) {
            $incident_image = url::convert_uploaded_to_abs($media->media_thumb);
        }
    }
    ?>
		<tr>
			<td><a href="<?php 
    echo url::site() . 'reports/view/' . $incident_id;
    ?>
"> <?php 
    echo $incident_title;
    ?>
</a></td>
			<td><?php 
    echo html::escape($how_feel);
    ?>
</td>
开发者ID:uws-eresearch,项目名称:invisiblecity-ushahidi,代码行数:31,代码来源:main_reports.php

示例15: _generate_treeview_html

 /**
  * Traverses an array containing category data and returns a tree view
  *
  * @param array $category_data
  * @return string
  */
 private static function _generate_treeview_html($category_data)
 {
     // To hold the treeview HTMl
     $tree_html = "";
     foreach ($category_data as $id => $category) {
         // Determine the category class
         $category_class = $category['parent_id'] > 0 ? " class=\"report-listing-category-child\"" : "";
         $category_image = $category['category_image_thumb'] ? html::image(array('src' => url::convert_uploaded_to_abs($category['category_image_thumb']), 'style' => 'float:left;padding-right:5px;')) : NULL;
         $tree_html .= "<li" . $category_class . ">" . "<a href=\"#\" class=\"cat_selected\" id=\"filter_link_cat_" . $id . "\" title=\"{$category['category_description']}\">" . "<span class=\"item-swatch\" style=\"background-color: #" . $category['category_color'] . "\">{$category_image}</span>" . "<span class=\"item-title\">" . html::strip_tags($category['category_title']) . "</span>" . "<span class=\"item-count\">" . $category['report_count'] . "</span>" . "</a></li>";
         $tree_html .= self::_generate_treeview_html($category['children']);
     }
     // Return
     return $tree_html;
 }
开发者ID:niiyatii,项目名称:crowdmap,代码行数:20,代码来源:category.php


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