/**
  * Returns property
  *
  * @since 1.11
  * @todo Code pertaining to displaying data should be migrated to prepare_property_for_display() like :$real_value = nl2br($real_value);
  * @todo Fix the long dashes - when in latitude or longitude it breaks it when using static map
  *
  */
 public static function get($id, $args = false)
 {
     global $wp_properties;
     if (is_object($id) && isset($id->ID)) {
         $id = $id->ID;
     }
     $id = trim($id);
     extract($args = wp_parse_args($args, array('get_children' => 'true', 'return_object' => 'false', 'load_gallery' => 'true', 'load_thumbnail' => 'true', 'load_parent' => 'true', 'cache' => 'true')), EXTR_SKIP);
     $get_children = isset($get_children) && $get_children === 'true' ? true : false;
     $return_object = isset($return_object) && $return_object === 'true' ? true : false;
     $load_gallery = isset($load_gallery) && $load_gallery === 'true' ? true : false;
     $load_thumbnail = isset($load_thumbnail) && $load_thumbnail === 'true' ? true : false;
     $load_parent = isset($load_parent) && $load_parent === 'true' ? true : false;
     $cache = isset($cache) && $cache === 'true' ? true : false;
     if ($cache && ($property = wp_cache_get($id))) {
         // Do nothing here since we already have data from cache!
     } else {
         $property = array();
         $post = get_post($id, ARRAY_A);
         if ($post['post_type'] != 'property') {
             return false;
         }
         //** Figure out what all the editable attributes are, and get their keys */
         $editable_keys = array_keys(array_merge((array) $wp_properties['property_meta'], (array) $wp_properties['property_stats']));
         //** Load all meta keys for this object */
         if ($keys = get_post_custom($id)) {
             foreach ($keys as $key => $value) {
                 $attribute = Attributes::get_attribute_data($key);
                 if (!$attribute['multiple']) {
                     $value = $value[0];
                 }
                 $keyt = trim($key);
                 //** If has _ prefix it's a built-in WP key */
                 if ('_' == $keyt[0]) {
                     continue;
                 }
                 // Fix for boolean values
                 switch ($value) {
                     case 'true':
                         $real_value = true;
                         //** Converts all "true" to 1 */
                         break;
                     case 'false':
                         $real_value = false;
                         break;
                     default:
                         $real_value = $value;
                         break;
                 }
                 // Handle keys with multiple values
                 if (count($value) > 1) {
                     $property[$key] = $value;
                 } else {
                     $property[$key] = $real_value;
                 }
             }
         }
         $property = array_merge($property, $post);
         //** Make sure certain keys were not messed up by custom attributes */
         $property['system'] = array();
         $property['gallery'] = array();
         $property['wpp_gpid'] = \WPP_F::maybe_set_gpid($id);
         $property['permalink'] = get_permalink($id);
         //** Make sure property_type stays as slug, or it will break many things:  (widgets, class names, etc)  */
         if (!empty($property['property_type'])) {
             $property['property_type_label'] = get_property_type($id);
         }
         //** If phone number is not set but set globally, we load it into property array here */
         if (empty($property['phone_number']) && !empty($wp_properties['configuration']['phone_number'])) {
             $property['phone_number'] = $wp_properties['configuration']['phone_number'];
         }
         //* Get rid of all empty values */
         foreach ($property as $key => $item) {
             //** Don't blank keys starting w/ post_  - this should be converted to use get_attribute_data() to check where data is stored for better check - potanin@UD */
             if (strpos($key, 'post_') === 0) {
                 continue;
             }
             if (empty($item)) {
                 unset($property[$key]);
             }
         }
         wp_cache_add($id, $property);
     }
     /*
      * Load parent if exists and inherit Parent's atttributes.
      */
     if ($load_parent) {
         $property = self::extend_property_with_parent($property, $cache);
     }
     /*
      * Load Children and their attributes
      */
     if ($get_children) {
         $property = self::extend_property_with_children($property, $cache);
     }
     /*
      * Figure out what the thumbnail is, and load all sizes
      */
     if ($load_thumbnail) {
         $property = array_merge($property, self::get_thumbnail($id, $cache));
     }
     /*
      * Load all attached images and their sizes
      */
     if ($load_gallery) {
         $gallery = self::get_images($id, $cache);
         $property['gallery'] = !empty($gallery) ? $gallery : false;
     }
     if (is_array($property)) {
         ksort($property);
     }
     $property = apply_filters('wpp_get_property', $property, $args);
     //** Convert to object */
     if ($return_object) {
         $property = \WPP_F::array_to_object($property);
     }
     return $property;
 }
Example #2
0
 
   check_value(save.mon_dpct);
}
 
</script>

<form name="save" method="post" action="?ac=add&do=save&fileurl=property">
	<input type="hidden" name="savetype" value="add" />
<table class="TableBlock" border="0" width="90%" align="center">

    <tr>
      <td nowrap class="TableContent" width="15%"> 资产类别:</td>
      <td class="TableData">
        <select class="BigStatic" name="property_type">
		<?php 
get_property_type();
?>
		</select>		还没有分类? <a href="admin.php?ac=property_type&fileurl=property">点击添加分类>> </a></td>
    </tr>
    <tr>
      <td nowrap class="TableContent"> 资产编号:</td>
      <td class="TableData">
<input name="number" type="text" class="BigInput" id="number" style="width: 200px;" value="<?php 
echo get_date('YmdHis', PHP_TIME);
?>
" maxlength="100" />      </td>
    </tr>
	<tr>
      <td nowrap class="TableContent"> 资产名称:<?php 
get_helps();
?>
Example #3
0
 
</script>
<form name="save" method="post" action="?ac=edit&do=save&fileurl=property">
	<input type="hidden" name="savetype" value="edit" />
	<input type="hidden" name="id" value="<?php 
echo $blog['id'];
?>
" />
<table class="TableBlock" border="0" width="90%" align="center">

    <tr>
      <td nowrap class="TableContent" width="15%"> 资产类别:</td>
      <td class="TableData">
        <select class="BigStatic" name="property_type">
		<?php 
get_property_type($blog['property_type']);
?>
		</select>	</td>
    </tr>
    <tr>
      <td nowrap class="TableContent"> 资产编号:</td>
      <td class="TableData">  <?php 
echo $blog['number'];
?>
   </td>
    </tr>
	<tr>
      <td nowrap class="TableContent"> 资产名称:<?php 
get_helps();
?>
</td>