[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] property/inc/custom/organize_drawing.php, 1.1.2.8
From: |
nomail |
Subject: |
[Phpgroupware-cvs] property/inc/custom/organize_drawing.php, 1.1.2.8 |
Date: |
Wed, 10 Nov 2004 13:19:16 +0100 |
Update of /property/inc/custom
Modified Files:
Branch: proposed-0_9_18-branch
organize_drawing.php
date: 2004/11/10 12:19:16; author: sigurdne; state: Exp; lines: +59 -39
Log Message:
no message
=====================================================================
Index: property/inc/custom/organize_drawing.php
diff -u property/inc/custom/organize_drawing.php:1.1.2.7
property/inc/custom/organize_drawing.php:1.1.2.8
--- property/inc/custom/organize_drawing.php:1.1.2.7 Mon Nov 8 13:57:50 2004
+++ property/inc/custom/organize_drawing.php Wed Nov 10 12:19:16 2004
@@ -173,33 +173,22 @@
function get_files()
{
- $drawing_type=array(
- 'p' => 'plan',
- 'P' => 'plan',
- 's' => 'snitt',
- 'S' => 'snitt',
- );
-
$drawing_branch=array(
- 'a' => 'arkitekt',
- 'A' => 'arkitekt',
+ 'a' => 'arkitekt'
);
$category=array(
'plan' => 2,
- 'snitt' => 3
+ 'snitt' => 3,
+ 'fasade' => 4
);
$branch_id_array=array(
'arkitekt' => 13
);
-
-
$dir_handle = @opendir($this->dir);
-
-
$i=0; $myfilearray = '';
while ($file = @readdir($dir_handle))
{
@@ -217,26 +206,34 @@
$fname = $myfilearray[$i];
$loc1 = substr($myfilearray[$i],4,4);
$loc2 = substr($myfilearray[$i],8,2);
- $type =
$drawing_type[substr($myfilearray[$i],12,1)];
-
- if ($type=='plan')
- {
- $etasje = substr($myfilearray[$i],13,2);
- $loc3 = substr($myfilearray[$i],10,2);
- $location_code = $loc1 . '-' . $loc2 .
'-' . $loc3;
- }
- else
- {
- unset($etasje);
- unset($loc3);
- $type =
$drawing_type[substr($myfilearray[$i],10,1)];
- $location_code = $loc1 . '-' . $loc2;
- $nr = substr($myfilearray[$i],-8,3);
+ $etasje = '';
+ $loc3 = '';
+ $nr = '';
+ $direction = '';
+
+ $type = $this->get_type($myfilearray[$i]);
+ switch($type)
+ {
+ case 'plan':
+ $etasje =
substr($myfilearray[$i],13,2);
+ $loc3 =
substr($myfilearray[$i],10,2);
+ $location_code = $loc1 . '-' .
$loc2 . '-' . $loc3;
+ break;
+ case 'snitt':
+ $location_code = $loc1 . '-' .
$loc2;
+ $nr =
substr($myfilearray[$i],-8,3);
+ break;
+ case 'fasade':
+ $location_code = $loc1 . '-' .
$loc2;
+ $direction =
substr($myfilearray[$i],11,2);
+ $nr =
substr($myfilearray[$i],-8,3);
+ break;
}
- $branch =
$drawing_branch[substr($myfilearray[$i],-5,1)];
- if ($this->check_building($loc1,$loc2) && $type)
+ $branch =
$drawing_branch[strtolower(substr($myfilearray[$i],-5,1))];
+
+ if ($this->check_building($loc1,$loc2) && $type
&& $branch)
{
$file_list[] = array
(
@@ -250,6 +247,7 @@
'branch' => $branch,
'branch_id' =>
$branch_id_array[$branch],
'category_id' =>
$category[$type],
+ 'direction' => $direction,
'location_code' =>
$location_code,
);
}
@@ -258,6 +256,25 @@
return $file_list;
}
+
+ function get_type($filename='')
+ {
+ $drawing_type=array(
+ 'p' => 'plan',
+ 'f' => 'fasade',
+ 's' => 'snitt'
+ );
+
+ for ($i=10;$i<strlen($filename);$i++)
+ {
+ $type =
$drawing_type[strtolower(substr($filename,$i,1))];
+ if($type)
+ {
+ return $type;
+ }
+ }
+ }
+
function check_building($loc1='',$loc2='')
{
$sql = "SELECT count(*) FROM fm_location2 WHERE loc1=
'$loc1' AND loc2= '$loc2'";
@@ -333,17 +350,20 @@
else
{
$address =
$this->get_address($values['loc1'],$values['loc2'],$values['loc3']);
- if($values['etasje'])
- {
- $values['title'] =
$this->db->db_addslashes($values['branch'] . ', ' .$values['type'] . ', etasje:
' . $values['etasje']);
- }
- else
+
+ switch($values['type'])
{
- $values['title'] =
$this->db->db_addslashes($values['branch'] . ', ' . $values['type'] . ' nr: ' .
$values['nr']);
+ case 'plan':
+ $values['title'] =
$this->db->db_addslashes($values['branch'] . ', ' .$values['type'] . ', etasje:
' . $values['etasje']);
+ break;
+ case 'snitt':
+ $values['title'] =
$this->db->db_addslashes($values['branch'] . ', ' . $values['type'] . ' nr: ' .
$values['nr']);
+ break;
+ case 'fasade':
+ $values['title'] =
$this->db->db_addslashes($values['branch'] . ', ' . $values['type'] . ' nr: ' .
$values['nr'] . ' retning: ' . $values['direction']);
+ break;
}
-
-
$insert_values= array(
$values['file_name'],
$values['title'],
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] property/inc/custom/organize_drawing.php, 1.1.2.8,
nomail <=