Exemple #1
0
                if (!empty($commsy_config)) {
                    $treffer = array();
                    preg_match('~COMMSY_WIKI_TITLE[ ]*=[ ]*["|\'](.*)["|\']~u', $commsy_config, $treffer);
                    if (!empty($treffer[1])) {
                        $temp_array['title'] = stripslashes($treffer[1]);
                        $wiki_array[] = $temp_array;
                    }
                }
            }
            unset($temp_array);
            chdir('../..');
        }
    }
    closedir($handle);
}
$wiki_array = sortby($wiki_array);
$url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'];
$count = count($wiki_array);
if (empty($wiki_array)) {
    echo '* Bislang sind keine Wikis vorhanden.' . "\n";
} elseif ($count == 1) {
    echo '!!!Das neueste Wiki' . "\n";
    for ($i = 0; $i < $count; $i++) {
        $url2 = str_replace('index.php', $wiki_array[$i]['dir'] . '/', $url);
        echo '* [=<a href="' . $url2 . '">' . $wiki_array[$i]['title'] . '</a>=] (' . date("d.m.Y, H:i", $wiki_array[$i]['time']) . ')' . "\n";
    }
} elseif ($count < 10) {
    echo '!!!Die neuesten ' . $count . ' Wikis' . "\n";
    for ($i = 0; $i < $count; $i++) {
        $url2 = str_replace('index.php', $wiki_array[$i]['dir'] . '/', $url);
        echo '* [=<a href="' . $url2 . '">' . $wiki_array[$i]['title'] . '</a>=] (' . date("d.m.Y, H:i", $wiki_array[$i]['time']) . ')' . "\n";
Exemple #2
0
  public function getStats($mode, $cutBy='', $UserID=0) {
   $dealTiming = "16";  // in days
//   echo $mode."-".$cutBy;
   switch ($mode) {
    case ("common"):
     $listitems = new stdClass;
     
     $date                 = date("Y-m-d");
     $date_yesterday       = date("Y-m-d", strtotime("-1 days"));
     $date_thisweek_begin  = date("Y-m-d", strtotime(date('o-\\WW')));
     $date_prevweek_begin  = date("Y-m-d", strtotime(date('o-\\WW'))-7*86400);
     $date_thismonth_begin = date("Y-m-")."01";
     $date_prevmonth_begin = date("Y-m-", strtotime("-1 months"))."01";
     
     /*
     echo $date."<br>";
     echo $date_yesterday."<br>";
     echo $date_thisweek_begin."<br>";
     echo $date_prevweek_begin."<br>"; //.strtotime('-1 days')."<br>".(strtotime('-2 days')+86400)."<br>";
     echo $date_thismonth_begin."<br>";
     echo $date_prevmonth_begin."<br>";
     */
     
     $tablenames = array('objects', 'customers', 'agreements', 'deposits', 'handshakes');
     
     $sql_where_arr = array(
          "total" => "",
          "today" => " DATE(`DateTarget`) ='".$date."'",
      "yesterday" => " DATE(`DateTarget`) ='".$date_yesterday."'",
       "thisweek" => " DATE(`DateTarget`)>='".$date_thisweek_begin."'",
       "prevweek" => "(DATE(`DateTarget`)>='".$date_prevweek_begin."') AND (DATE(`DateTarget`)<'".$date_thisweek_begin."')",
      "thismonth" => " DATE(`DateTarget`)>='".$date_thismonth_begin."'",
      "prevmonth" => "(DATE(`DateTarget`)>='".$date_prevmonth_begin."') AND (DATE(`DateTarget`)<'".$date_thismonth_begin."')"
     );
     
     foreach ($tablenames as $tablename) {
      foreach ($sql_where_arr as $k=>$sql_where) {
       if ($tablename=='agreements') {
        if ($sql_where) $sql_where.=" AND ";
        $sql_where.="(`HasAgreement` = 1)";
       }
       if ($tablename=='deposits') {
        if ($sql_where) $sql_where.=" AND ";
        $sql_where.="(`DepositReceived` = 1)";
       }
       if ($tablename=='handshakes') {
        if ($sql_where) $sql_where.=" AND ";
        $sql_where.="(`Handshake` = 1)";
       }
       
       if ($UserID) {
        if ($sql_where) $sql_where.=" AND ";
        $sql_where .= "
         (`UserID`=".$UserID.")
        ";
       }
       
       if ($sql_where) $sql_where = "WHERE ".$sql_where;
       $sql="
        SELECT   COUNT(`ID`) AS `Cnt`
        FROM     `".((($tablename=='agreements') || ($tablename=='deposits') || ($tablename=='handshakes'))?"customers":$tablename)."`
        ".$sql_where."
        ; 
       ";
//       echo $sql;
       $item=$this->db->query_first($sql);
//       ajax_echo_r ($item);
       
       $name = $tablename."_".$k;
       $listitems->$name = $item->Cnt;
      }
     }
     
     
     
     
     $tablename = 'users';
     $sql_where_arr = array(
          "total" => "",
          "today" => "",
      "yesterday" => " DATE(`DateAdded`)<='".$date_yesterday."'",
       "thisweek" => " DATE(`DateAdded`)< '".$date_thisweek_begin."'",
       "prevweek" => "(DATE(`DateAdded`)< '".$date_prevweek_begin."')",
      "thismonth" => " DATE(`DateAdded`)< '".$date_thismonth_begin."'",
      "prevmonth" => "(DATE(`DateAdded`)< '".$date_prevmonth_begin."')"
     );
     foreach ($sql_where_arr as $k=>$sql_where) {
      if ($sql_where) $sql_where.=" AND ";
      $sql_where.="(`IsManager` = 1)";
      
      if ($sql_where) $sql_where = "WHERE ".$sql_where;
      $sql="
       SELECT   COUNT(`ID`) AS `Cnt`
       FROM     `".(($tablename=='handshakes')?"objects":$tablename)."`
       ".$sql_where."
       ; 
      ";
//       echo $sql;
      $item=$this->db->query_first($sql);
//       ajax_echo_r ($item);
      
      $name = $tablename."_".$k;
      $listitems->$name = $item->Cnt;
     }
     
     /*
     $sql="
      SELECT   COUNT(`ID`) AS `Cnt`
      FROM     `objects`
      WHERE    (`Handshake` = 1) AND (DATE(`DateAdded`)>='".$date_thisweek_begin."')
      ; 
     ";
     $item=$this->db->query_first($sql);
     $listitems->handshakes_thisweek = $item->Cnt;
     */
     
//       ajax_echo_r ($item);
     
     $buf = explode("-", $date_prevmonth_begin);
     $thismonth_days = cal_days_in_month(CAL_GREGORIAN, date('m'), date('Y'));
     $prevmonth_days = cal_days_in_month(CAL_GREGORIAN, $buf[1], $buf[0]);
     
//     echo $thismonth_days;
//     echo $prevmonth_days;
     
     // DT = 2 weeks, таким образом, каждый риелтор по плану делает одну сделку один раз в две недели. Здесь 3 вместо 2, потому как я пожалел риелторов     
     $listitems->handshakes_today_plan      = ceil($listitems->users_today/$dealTiming);
     $listitems->handshakes_yesterday_plan  = ceil($listitems->users_yesterday/$dealTiming);
     $listitems->handshakes_thisweek_plan   = ceil($listitems->users_thisweek /$dealTiming*7);
     $listitems->handshakes_prevweek_plan   = ceil($listitems->users_prevweek /$dealTiming*7);
     $listitems->handshakes_thismonth_plan  = ceil($listitems->users_thismonth/$dealTiming*$thismonth_days);
     $listitems->handshakes_prevmonth_plan  = ceil($listitems->users_prevmonth/$dealTiming*$prevmonth_days);
     
     $listitems->handshakes_auto = 0;
     
//     $listitems->objects_total = $item->Cnt;
//     ajax_echo_r ($listitems);
     
    break;
    case ("customers"):
     switch ($cutBy) {
      case ("customersources"):
       $sql="
        SELECT   `ID`, `Description`
        FROM     `customersources`
        WHERE    `CustomerTypeID`=1
        ORDER BY `Description`
        ; 
       ";
       $listitems=$this->db->query_assoc($sql, 'ID');
      break;
      case ("markets"):
       $sql="
        SELECT   `ID`, `Description`
        FROM     `markets`
        ORDER BY `Description`
        ; 
       ";
       $listitems=$this->db->query_assoc($sql, 'ID');
      break;
      case ("users"):
       $sql="
        SELECT   `ID`, CONCAT(`Firstname`,' ',`Surname`) AS `Description`
        FROM     `users`
        ORDER BY `Firstname`, `Surname`
        ; 
       ";
       $listitems=$this->db->query_assoc($sql, 'ID');
//       ajax_echo_r ($listitems);
      break;
     }
     
     $objTotal = new stdClass;
     $objTotal->ID = 0;
     $objTotal->Description = "Итого";
     $listitems['total']=$objTotal;
     
     $options = array('total', 'TargetContact', 'OfficeVisit', 'ObjectShow', 'HasAgreement', 'DepositReceived', 'Handshake');
     
     foreach ($listitems as $listitem) {
      foreach ($options as $option) {
       $sql_where = "";
       if ($option!='total') {
        if ($sql_where) $sql_where.=" AND ";
        $sql_where .= "
         (`".$option."`=1)
        ";
       }
       if ($listitem->ID) {
        if ($sql_where) $sql_where.=" AND ";
        switch ($cutBy) {
         case ("customersources"):
          $sql_where .= "
           (`SourceID`='".$listitem->ID."')
          ";
         break;
         case ("markets"):
          $sql_where .= "
           (`MarketID`='".$listitem->ID."')
          ";
         break;
         case ("users"):
          $sql_where .= "
           (`UserID`='".$listitem->ID."')
          ";
         break;
        }
       }
       
       if ($UserID) {
        if ($sql_where) $sql_where.=" AND ";
        $sql_where .= "
         (`UserID`=".$UserID.")
        ";
       }
       
       if ($sql_where) $sql_where = "WHERE ".$sql_where;
       $sql="
        SELECT   COUNT(`customers`.`ID`) AS `Cnt`
        FROM     `customers`
        ".$sql_where."
        ;
       ";
       
       $name = $option."_c";
//       echo $sql."<br>";
       $lst=$this->db->query_first($sql);
       $listitem->$name = floatval($lst->Cnt);
      }
     }
     
     $listitems = $this->fillTotals($listitems, $options);
    break;
    case ("objects"):
     switch ($cutBy) {
      case ("customersources"):
       $sql="
        SELECT   `ID`, `Description`
        FROM     `customersources`
        WHERE    `CustomerTypeID`=2
        ORDER BY `Description`
        ; 
       ";
       $listitems=$this->db->query_assoc($sql, 'ID');
      break;
      case ("markets"):
       $sql="
        SELECT   `ID`, `Description`
        FROM     `markets`
        ORDER BY `Description`
        ; 
       ";
       $listitems=$this->db->query_assoc($sql, 'ID');
      break;
      case ("users"):
       $sql="
        SELECT   `ID`, CONCAT(`Firstname`,' ',`Surname`) AS `Description`
        FROM     `users`
        ORDER BY `Firstname`, `Surname`
        ; 
       ";
       $listitems=$this->db->query_assoc($sql, 'ID');
//       ajax_echo_r ($listitems);
      break;
     }
     
     $objTotal = new stdClass;
     $objTotal->ID = 0;
     $objTotal->Description = "Итого";
     $listitems['total']=$objTotal;
     
     $options = array('total', 'TargetContact', 'TargetMeeting', 'OfficeVisit', 'ObjectShow', 'TargetAgreed', 'HasAgreement', 'DepositReceived', 'Handshake', 'GiftsGiven');
     
     foreach ($listitems as $listitem) {
      foreach ($options as $option) {
       $sql_where = "";
       if ($option!='total') {
        if ($sql_where) $sql_where.=" AND ";
        $sql_where .= "
         (`".$option."`=1)
        ";
       }
       if ($listitem->ID) {
        if ($sql_where) $sql_where.=" AND ";
        switch ($cutBy) {
         case ("customersources"):
          $sql_where .= "
           (`SourceID`='".$listitem->ID."')
          ";
         break;
         case ("markets"):
          $sql_where .= "
           (`MarketID`='".$listitem->ID."')
          ";
         break;
         case ("users"):
          $sql_where .= "
           (`UserID`='".$listitem->ID."')
          ";
         break;
        }
       }
       
       if ($UserID) {
        if ($sql_where) $sql_where.=" AND ";
        $sql_where .= "
         (`UserID`=".$UserID.")
        ";
       }
       
       if ($sql_where) $sql_where = "WHERE ".$sql_where;
       $sql="
        SELECT   COUNT(`ID`) AS `Cnt`
        FROM     `objects`
        ".$sql_where."
        ;
       ";
       
       $name = $option."_c";
       
       $lst=$this->db->query_first($sql);
       $listitem->$name = floatval($lst->Cnt);
      }
     }
     
     $listitems = $this->fillTotals($listitems, $options);
    
    break;
    case ("monthly"):
     echo 1;
    break;
   }
//   echo $sql;
//   $listitems=$this->db->query_assoc($sql, 'ID');
   
   switch ($mode) {
//    case ("common"):
    case ("customers"):
    case ("objects"):
     sortby ($listitems, "total_c");
    break;
   }
   
//   ajax_echo_r ($listitems);
   
   
   return $listitems;
  }
Exemple #3
0
function dirlist($dir = './', $up = true, $sortby = '', $sortdes = '', $rq = false)
{
    global $dirlist_icondir;
    if (!$dir) {
        $dir = './';
    }
    $dfiles = getdfiles($dir, array('cgi-bin'));
    if ($sortby) {
        $dfiles = sortby($dfiles, $sortby, $sortdes);
    }
    if (count($dfiles) == 0) {
        ?>
<div id="dirlist">
  <div class="nofiles">This directory contains no files.</div>
</div>
<?php 
    } else {
        ?>
<div id="dirlist">
  <table border="0" cellspacing="0" cellpadding="0">
    <tr style="border-bottom:1px solid #777777;">
      <th style="width:32px;text-align:left;" width="32">
        <div style="padding:1px;border-bottom:1px solid #777777;">&nbsp;</div>
      </td>
      <th style="text-align:left;">
        <div style="padding:1px 5px;font-style:italic;border-bottom:1px solid #777777;">Name</div>
      </td>
      <th style="text-align:left;">
        <div style="padding:1px 5px;font-style:italic;border-bottom:1px solid #777777;">Type</div>
      </td>
      <th style="text-align:left;">
        <div style="padding:1px 5px;font-style:italic;border-bottom:1px solid #777777;">Size</div>
      </td>
      <th style="text-align:left;">
        <div style="padding:1px 5px;font-style:italic;border-bottom:1px solid #777777;">Modified</div>
      </td>
    </tr>
<?php 
        if ($up) {
            ?>
    <tr>
      <td>
        <a href="../"><img src="<?php 
            echo $dirlist_icondir . '_udir.gif';
            ?>
" width="32" height="32" alt="dir" style="border:0" /></a>
      </td>
      <td colspan="4">
        <a href="../" style="display:block;overflow:hidden;padding:1px 10px 1px 5px;text-decoration:none;color:#000000;">../ <span style="color:#777777">(Up one level)</span></a>
      </td>
    </tr>
<?php 
        }
        foreach ($dfiles as $dfile) {
            $dfp = '';
            if ($dfile['ext'] == 'flv') {
                $dfp = '/fileman/flvplayer.php?d=' . ($rq ? $rq : substr($_SERVER['PHP_SELF'], 1, strrpos($_SERVER['PHP_SELF'], '/')));
            }
            ?>
    <tr>
      <td>
        <a href="<?php 
            echo $dfp, urlencode($dfile['name']);
            ?>
"><img src="<?php 
            echo $dirlist_icondir . $dfile['img'] . '.gif';
            ?>
" width="32" height="32" alt="<?php 
            echo $dfile['ext'];
            ?>
" style="border:0" /></a>
      </td>
      <td>
        <a href="<?php 
            echo $dfp, urlencode($dfile['name']);
            ?>
" style="display:block;overflow:hidden;padding:1px 10px 1px 5px;text-decoration:none;color:#000000;<?php 
            if ((!$dir || $dir == './') && basename($_SERVER['PHP_SELF']) == $dfile['name']) {
                echo 'text-decoration:underline;';
            }
            ?>
"><?php 
            echo $dfile['name'];
            ?>
</a>
      </td>
      <td>
        <div style="overflow:hidden;padding:1px 10px 1px 5px;color:#777777;"><?php 
            echo $dfile['type'];
            ?>
</div>
      </td>
      <td>
        <div style="overflow:hidden;padding:1px 10px 1px 5px;color:#777777;"><?php 
            echo $dfile['ft'] == 1 ? '&nbsp;' : $dfile['tsize'];
            ?>
</div>
      </td>
      <td>
        <div style="overflow:hidden;padding:1px 10px 1px 5px;color:#777777;"><?php 
            echo date('Y M j', $dfile['modified']);
            ?>
</div>
      </td>
    </tr>
<?php 
        }
        ?>
  </table>
</div>
<?php 
    }
}