예제 #1
0
파일: open.php 프로젝트: romlg/blank-xpage
 function ocd_list()
 {
     $m = $this->GetGP("month", 0);
     $endDateYear = $this->GetGP("year", 0);
     if ($m != 0 and $endDateYear != 0) {
         $days = getDays($m, $endDateYear);
         $content2 = "<table width='100%' cellspacing='0' cellpadding='0' bgcolor='#FFF8DC' class='w_border'>";
         for ($i = 1; $i <= $days; $i++) {
             $startDate = mktime(0, 0, 0, $m, $i, $endDateYear);
             $finishDate = mktime(23, 59, 59, $m, $i, $endDateYear);
             $totalForPeriod = $this->db->GetOne("Select Count(*) From stats_visitors Where thetime>" . $startDate . " And thetime<" . $finishDate);
             $totalUnique = $this->db->GetOne("Select Count(Distinct ipaddress) From stats_visitors Where thetime>" . $startDate . " And thetime<" . $finishDate);
             $hits = $this->db->GetOne("Select Count(*) From stats_views Where thetime>" . $startDate . " And thetime<" . $finishDate);
             $quant = $this->db->GetOne("Select Count(Distinct visitor_id) From stats_views Where thetime>" . $startDate . " And thetime<" . $finishDate);
             $result = $this->db->ExecuteSql("Select Distinct visitor_id From stats_views Where thetime>" . $startDate . " And thetime<" . $finishDate);
             $s = 0;
             while ($row = $this->db->FetchInArray($result)) {
                 $s = $s + $this->db->GetOne("Select Count(Distinct page) From stats_views Where visitor_id=" . $row['visitor_id'] . " And thetime>" . $startDate . " And thetime<" . $finishDate);
             }
             $this->db->FreeSqlResult($result);
             $pages = $s;
             $date = mktime(0, 0, 0, $m, $i, $endDateYear);
             $date = date("d", $date);
             $content2 .= "<tr><td align='center' class='w_border'>{$date}</td>";
             $content2 .= "<td style='width:149px;' align='center' class='w_border'>" . $totalForPeriod . "</td><td style='width:149px;' align='center' class='w_border'>" . $totalUnique . "</td><td style='width:149px;' align='center' class='w_border'>" . $hits . "</td><td style='width:149px;' align='center' class='w_border'>" . $pages . "</td></tr>";
         }
         $content2 .= "</table>";
         $open_month = $content2 . "<br><a href='javascript:close_month({$m}, {$endDateYear})'><img src='./images/close_up.gif' border='0' align='bottom' alt='' /></a>";
         print $open_month;
         exit;
     }
     $country = $this->GetGP("country", "");
     $startDate = $this->GetGP("startdate", 0);
     $finishDate = $this->GetGP("finishdate", 0);
     if ($country != "" and $startDate > 0 and $finishDate > 0) {
         $count = $this->db->GetOne("Select Count(distinct city) From `stats_visitors` Where country='{$country}' And thetime>" . $startDate . " And thetime<" . $finishDate, 0);
         if ($count > 0) {
             $result = $this->db->ExecuteSql("Select distinct city From `stats_visitors` Where country='{$country}' And thetime>" . $startDate . " And thetime<" . $finishDate . " Order By city", 0);
             $content2 = "<table width='100%' cellspacing='0' cellpadding='1' bgcolor='#FFF8DC' class='w_border' border='0'>";
             $content2 .= "<tr bgcolor='#FAEBD7'><td class='w_border' align='center'><b>Cities</b></td><td class='w_border' align='center'><b>Visitors</b></td></tr>";
             while ($row = $this->db->FetchInArray($result)) {
                 $city = $row["city"];
                 $count_city = $this->db->GetOne("Select Count(*) From `stats_visitors` Where city='{$city}' And country='{$country}'", 0);
                 $content2 .= "<tr><td class='w_border' style='padding-left:5px;'>{$city}</td><td class='w_border' style='padding-left:5px;'>{$count_city}</td></tr>";
             }
             $this->db->FreeSqlResult($result);
             $content2 .= "</table>";
         }
         $result = $content2 . "<br><a href='javascript:close_country({$country}, {$startDate}, {$finishDate})'><img src='./images/close_up.gif' border='0' align='bottom' alt='' /></a>";
         print $result;
         exit;
     }
 }
예제 #2
0
 /**
  *選択した日付の週の初めと終わりの日付を取得
  *
  * @param
  */
 function getWeeklyDays($date)
 {
     //YYYYMMDDのみ
     //該当週取得
     $sql = 'select start_date, end_date from m_term where end_date >= :date and start_date <= :date';
     $searchParam['date'] = $date;
     // データベースに接続する
     $conn = DbControl::getInstance();
     $conn->dbConnect(DbControl::SLAVE_DB);
     // クエリを実行する
     $res = $conn->dbExecFetch(DbControl::SLAVE_DB, $sql, $searchParam);
     foreach ($res as $key => $val) {
         $result[$key]['year'] = getYear($val);
         $result[$key]['month'] = getMonth($val);
         $result[$key]['date'] = getDays($val);
     }
     // データベースを切断する
     $conn->dbClose(DbControl::SLAVE_DB);
     return $result;
 }
예제 #3
0
?>
">Formatted Excel Sheet for <?php 
if ($_GET['mydate']) {
    echo $_GET['mydate'];
} else {
    echo date('Y-m-d');
}
?>
</a>
<?php 
if ($_GET['mydate']) {
    $time = strtotime($_GET['mydate']);
} else {
    $time = time();
}
$arr = getDays($time);
$fromdate = $arr['monday']['year'] . "-" . $arr['monday']['mon'] . "-" . $arr['monday']['mday'];
$todate = $arr['sunday']['year'] . "-" . $arr['sunday']['mon'] . "-" . $arr['sunday']['mday'];
?>
<table width="100%"  border="0" cellspacing="0" cellpadding="5">
  <tr>
    <td valign="top">
<?php 
// get array
include_once 'f_workinghours.php';
// end array
$result = getTimeSheetNew2($time, $_GET['user_id']);
echo $result;
?>
</td>
    <td valign="top" align="right"><?php 
예제 #4
0
function showForm()
{
    $options = getDays();
    //get list of known measure days
    $currentscript = $_SERVER['PHP_SELF'];
    //print search form
    echo "<form id='form1' method='get' action='" . $currentscript . "'>";
    echo '<input id="start" type="text" name="start" >';
    //value="'."201401291027".'" >';
    echo '<input id="end" type="text" name="end" >';
    //value="'."201401301027".'" >';
    echo '<input type="submit" name="cmd" value="Anzeigen">';
    $days = "<p><label>Tage</label>:\r\n    <select name='days' id='days' >\r\n      " . $options . "\r\n    </select>";
    echo $days;
    $tag_changed = "<script type='text/javascript'>\r\n    function tag_changed(idx){\r\n      //if(idx==-1)\r\n      //   return;\r\n      var tag = document.getElementById('days').value;\r\n      document.getElementById('start').value=tag+'0000';\r\n      document.getElementById('end').value=tag+'2359';\r\n      //alert('you selected: '+tag);\r\n    }\r\n    </script>";
    echo $tag_changed;
    echo '<input type="button" name="cmd_tag" onclick="javascript:tag_changed();" value="&uuml;bernehmen"></p>';
    echo '</form>';
}
예제 #5
0
 function getTimeSheetNew2($time, $user_id)
 {
     static $did1 = 0;
     $colname_rsTimesheet = "-1";
     if (isset($user_id)) {
         $colname_rsTimesheet = get_magic_quotes_gpc() ? $user_id : addslashes($user_id);
     }
     $query_rsTimesheet = sprintf("SELECT * FROM procentris_timesheet WHERE user_id = %s", $colname_rsTimesheet);
     $rsTimesheet = mysql_query($query_rsTimesheet) or die(mysql_error());
     $row_rsTimesheet = mysql_fetch_assoc($rsTimesheet);
     $totalRows_rsTimesheet = mysql_num_rows($rsTimesheet);
     $returnArray = getWorkingHours($time, $user_id);
     $today = getdate($time);
     $chkdate = $today['weekday'];
     $chkdate2 = strtolower($chkdate);
     $arr = getDays($time);
     $fromdate = $arr['monday']['year'] . "-" . $arr['monday']['mon'] . "-" . $arr['monday']['mday'];
     $todate = $arr['sunday']['year'] . "-" . $arr['sunday']['mon'] . "-" . $arr['sunday']['mday'];
     //$fromdate = $arr[$chkdate2]['year']."-".$arr[$chkdate2]['mon']."-".$arr[$chkdate2]['mday'];
     //$todate = $arr[$chkdate2]['year']."-".$arr[$chkdate2]['mon']."-".$arr[$chkdate2]['mday'];
     $category = array();
     $category = getAllCategory($user_id);
     $result = '<div id="divTimesheetNew"><br><br>';
     //$result .= "<a href=\"javascript:doAjax('ajaxAddNew.php','GET','user_id=".$user_id."&mydate=".date('Y-m-d',$time)."','','newCategory');\">ADD NEW TASK</a><br>";
     //$result .= "<div id='newCategory'></div>";
     if ($category) {
         $result .= '<br>';
         foreach ($category as $categoryKey => $categoryValue) {
             $categorycnt[$categoryValue] = 1;
             if ($categorycnt[$categoryValue] == 1) {
                 $result .= "<a href=\"javascript:toggleLayer2('c" . $categoryKey . "');\"><img border=0 align=left height=11 width=13 src=images/is.jpg title='Show Projects'></a> ";
                 $result .= '<font color=blue><b>' . $categoryValue . '</b></font>';
                 $did1++;
                 $did = "div" . $did1;
                 $result .= '<form name="' . $did . '" action="" method="post">Add New Project: <input type="text" name="list" value="" size=8><input type="hidden" value="' . $categoryKey . '" name="pid"><input type="hidden" value="' . $user_id . '" name="user_id"><input type="hidden" value="2" name="level"><input type="hidden" value="Project" name="list_type"><input type="hidden" value="c' . $categoryKey . '" name="showCategory"><input type="submit" name="Go" value="Go"></form>';
             }
             $project = getAllProject($user_id, $categoryKey);
             if ($project) {
                 $result .= '<div id="c' . $categoryKey . '" style="display:none;">';
                 foreach ($project as $projectKey => $projectValue) {
                     $projectcnt[$projectValue] = 1;
                     if ($projectcnt[$projectValue] == 1) {
                         $did1++;
                         $did = "div" . $did1;
                         $result .= '<blockquote>';
                         $result .= "<a href=\"javascript:toggleLayer2('p" . $projectKey . "');\"><img border=0 align=left height=11 width=13 src=images/is.jpg title='Show Tasks'></a> ";
                         $result .= '<font color=red><b>' . $projectValue . '</b></font>';
                         $did1++;
                         $did = "div" . $did1;
                         $result .= '<form name="' . $did . '" action="" method="post">Add New Task: <input type="text" name="list" value="" size=8><input type="hidden" value="' . $projectKey . '" name="pid"><input type="hidden" value="' . $user_id . '" name="user_id"><input type="hidden" value="3" name="level"><input type="hidden" value="Task" name="list_type"><input type="hidden" value="p' . $projectKey . '" name="showProject"><input type="hidden" value="c' . $categoryKey . '" name="showCategory"><input type="submit" name="Go" value="Go"></form>';
                         $result .= '</blockquote>';
                     }
                     $result .= "<div id='p" . $projectKey . "' style='display:none;'>";
                     // start of code
                     $task = getAllTask($user_id, $categoryKey, $projectKey);
                     if ($task) {
                         $j = 0;
                         $result1 = "";
                         foreach ($task as $taskKey => $taskValue) {
                             $categorycnt[$categoryValue]++;
                             $projectcnt[$projectValue]++;
                             $result1 .= '<td align=left><b>' . $taskValue . '</b></td>';
                             $i = 0;
                             $totalh[$j] = 0;
                             foreach ($arr as $key => $value) {
                                 $timetaken[$i] = getTime($user_id, $categoryKey, $projectKey, $taskKey, $arr[$key]['year'] . "-" . $arr[$key]['mon'] . "-" . $arr[$key]['mday']);
                                 if (number_format($timetaken[$i], 2) == "0.00") {
                                     $taketime = "&nbsp;";
                                 } else {
                                     $taketime = number_format($timetaken[$i], 2);
                                 }
                                 // end of if timetaken
                                 $did1++;
                                 //$cid = "divc".$categoryKey."p".$projectKey."t".$taskKey."a".$did1;
                                 $did = "div" . $did1;
                                 $result1 .= "<td align=right><div id='" . $did . "'>" . $taketime . "<a href=\"javascript:doAjax('ajax_input.php','GET','user_id=" . $user_id . "&category=" . $categoryKey . "&project=" . $projectKey . "&tasks=" . $taskKey . "&cdate=" . date('Y-m-d', $value[0]) . "&cday=" . date('d', $value[0]) . "&cmonth=" . date('m', $value[0]) . "&cyear=" . date('Y', $value[0]) . "&timetaken=" . number_format($timetaken[$i], 2) . "&did=" . $did . "&mydate=" . date('Y-m-d', $time) . "','','" . $did . "');\"><img border=0 height=5 width=5 align=right src=images/is.jpg></a></div></td>";
                                 $totalv[$key] += $timetaken[$i];
                                 $totalh[$j] += $timetaken[$i];
                                 $i++;
                             }
                             // end of foreach $arr as $key=>$value
                             $j++;
                             $result1 .= '</tr>';
                         }
                         // end of foreach task
                         // end of code
                         $tmp = "";
                         $tmp = wireframe($today, $arr, $returnArray, $result1);
                         $result .= "<blockquote><blockquote>";
                         $result .= $tmp;
                         $result .= "</blockquote></blockquote>";
                     }
                     // end of if task
                     $result .= "</div>";
                 }
                 $result .= '</div>';
             }
         }
     }
     $result .= "</div>";
     $result .= "<div id='tempDiv'></div>";
     return $result;
 }
예제 #6
0
$colname_rsList = "-1";
if (isset($_GET['list_id'])) {
    $colname_rsList = get_magic_quotes_gpc() ? $_GET['list_id'] : addslashes($_GET['list_id']);
}
mysql_select_db($database_conn, $conn);
$query_rsList = sprintf("SELECT a.list as task, b.list as project, c.list as cat, a.list_id as task_id, b.list_id as project_id, c.list_id as cat_id FROM procentris_list as a, procentris_list as b, procentris_list as c WHERE a.pid = b.list_id and b.pid = c.list_id and a.list_id = %s", $colname_rsList);
$rsList = mysql_query($query_rsList, $conn) or die(mysql_error());
$row_rsList = mysql_fetch_assoc($rsList);
$totalRows_rsList = mysql_num_rows($rsList);
?>
Date: 
<select name="cdate">  
  <?php 
$Week = getDays(time());
$pre = $Week['monday'][0] - 60 * 60 * 24;
$Week2 = getDays($pre);
$nows = getdate();
if ($nows['wday'] == 2 || $nows['wday'] == 1) {
    foreach ($Week2 as $key => $value) {
        echo "<option value='" . $Week2[$key]['year'] . "-" . $Week2[$key]['mon'] . "-" . $Week2[$key]['mday'] . "'";
        if (date('Y-m-j') == $Week2[$key]['year'] . "-" . $Week2[$key]['mon'] . "-" . $Week2[$key]['mday']) {
            echo " selected";
        }
        echo ">" . $Week2[$key]['year'] . "-" . $Week2[$key]['mon'] . "-" . $Week2[$key]['mday'] . "</option>";
        $displayArray[$Week2[$key]['year'] . "-" . $Week2[$key]['mon'] . "-" . $Week2[$key]['mday']] = $Week2[$key]['mday'];
    }
}
foreach ($Week as $key => $value) {
    echo "<option value='" . $Week[$key]['year'] . "-" . $Week[$key]['mon'] . "-" . $Week[$key]['mday'] . "'";
    if (date('Y-m-j') == $Week[$key]['year'] . "-" . $Week[$key]['mon'] . "-" . $Week[$key]['mday']) {
        echo " selected";
예제 #7
0
function getTopDeviations($account = null, $count = null)
{
    $pcount = $count;
    $qcount = tryGET('count');
    $vcount = 10;
    if (isset($pcount)) {
        $vcount = $pcount;
    } else {
        if (isset($qcount)) {
            $vcount = $qcount;
        }
    }
    if ($vcount > 100) {
        $vcount = 100;
    }
    $settings = getSettings();
    if (!isset($account)) {
        $account = $settings["Account"];
    }
    $start = tryGET('start');
    $end = tryGET('end');
    if (!isset($start) || !isset($end)) {
        return null;
    }
    $ndays = getDays($start, $end);
    $start = GoogleDate($start);
    $end = GoogleDate($end);
    $analytics = getAnalytics();
    $filter = "";
    //More than 1 pageview an hour to cut down on outliers and processing
    $dims = "ga:hostname,ga:pagePath,ga:date";
    $metric = "ga:pageviews";
    $sort = "-ga:pageviews";
    $count = 10000;
    //max
    $data = runQuery($analytics, $account, $start, $end, $metric, $dims, $sort, $count, $filter);
    if (isset($data->ga_error)) {
        return DoNotCache();
    }
    $data = $data->getRows();
    $values = array();
    $path = '';
    $tvals = array();
    foreach ($data as $key => $row) {
        if (!isset($values[$row[0] . $row[1]])) {
            $values[$row[0] . $row[1]] = array();
        }
        array_push($values[$row[0] . $row[1]], floatval($row[3]));
    }
    foreach ($values as $key => $val) {
        $rem = $ndays - count($val);
        for ($i = 0; $i < $rem; $i++) {
            array_push($val, 0);
        }
        $mean = mean($val);
        if ($mean < 1) {
            continue;
        }
        //Aviod super low page averages
        $sd = stdev($mean, $val);
        if ($sd == 0) {
            continue;
        }
        //Let's not deal with how this is even possible for right now
        $stdevs[$key] = array('mean' => $mean, 'stdev' => $sd, 'values' => $val);
    }
    $count = 100 * $vcount;
    $filter = "";
    $dims = "ga:date,ga:hour,ga:hostname,ga:pagePath,ga:pageTitle";
    $metric = "ga:pageviews";
    $sort = "-ga:pageviews";
    $data = runQuery($analytics, $account, $start, $end, $metric, $dims, $sort, $count, $filter);
    if (isset($data->ga_error)) {
        return DoNotCache();
    }
    $data = $data->getRows();
    $result = array();
    foreach ($data as $key => $row) {
        $path = $row[2] . $row[3];
        if (!isset($stdevs[$path])) {
            continue;
        }
        //if($sd['mean'] <= 0) continue;
        $sd = $stdevs[$path];
        $z = zscore($sd['stdev'], $sd['mean'], $row[5]);
        $y = substr($row[0], 0, 4);
        $m = substr($row[0], 4, 2);
        $d = substr($row[0], 6, 2);
        $time = "{$y}-{$m}-{$d} " . $row[1] . ":00";
        $ts = strtotime($time);
        $result[] = array('path' => $path, 'title' => $row[4], 'mean' => $sd['mean'], 'stdev' => $sd['stdev'], 'pageviews' => $row[5], 'z' => $z, 'timestamp' => $ts, "time" => $time, "values" => $sd['values']);
    }
    usort($result, "zsort");
    $ret = array_splice($result, 0, $vcount);
    return $ret;
}
예제 #8
0
echo '<h1>Status &quot;finished&quot; (' . count($res['orphan_finished']) . ')</h1>';
echo '<table border="0" cellspacing="0">';
echo '<tr>';
echo '<th>Name</th>';
echo '<th>Draft-Date</th>';
echo '<th>Proposal-Date</th>';
echo '<th>Vote-Date</th>';
echo '<th>Extended-Date</th>';
// echo '<th>Last change</th>';
// echo '<th>Last comment</th>';
echo '<th>Proposer</th>';
echo '<th>Search package</th>';
echo '</tr>';
$i = 0;
foreach ($res['orphan_finished'] as $set) {
    echo '<tr style=' . ($i++ % 2 == 0 ? '"background-color: #CCCCCC;"' : '') . '>';
    echo '<td class="textcell"><a href="/pepr/pepr-proposal-show.php?id=' . $set['id'] . '">' . $set['pkg_name'] . '</a></td>';
    echo '<td class="textcell">' . getDays($set['draft_date']) . ' days ago<br />(' . format_date($set['draft_date']) . ')</td>';
    echo '<td class="textcell">' . getDays($set['proposal_date']) . ' days ago<br /> (' . format_date($set['proposal_date']) . ')</td>';
    echo '<td class="textcell">' . getDays($set['vote_date']) . ' days ago<br /> (' . format_date($set['vote_date']) . ')</td>';
    if ($set['longened_date'] > 1000) {
        echo '<td class="textcell">' . getDays($set['longened_date']) . ' days ago<br /> (' . format_date($set['longened_date']) . ')</td>';
    } else {
        echo '<td class="textcell">-</td>';
    }
    echo '<td class="textcell">' . user_link($set['user_handle']) . '</td>';
    echo '<td class="textcell"><a href="/search.php?q=' . urlencode(str_replace('_', ' ', strtolower($set['pkg_name']))) . '">Search registered package</a></td>';
    echo '</tr>';
}
echo '</table>';
// }}}
예제 #9
0
 public function getCategory($id)
 {
     $field = 'updated_at';
     $type = 'decs';
     if (Request::is('category/*/most')) {
         $field = 'frequency';
         $type = 'decs';
     }
     $results = Link::where('middle_categories_id', '=', $id)->orderBy($field, $type)->get();
     $results = getDays($results);
     $result = MiddleCategories::where('id', $id)->first();
     $this->breadcrumbs->push('หมวดหมู่', URL::to('/categories'));
     $this->breadcrumbs->push($result->name, URL::to('/category/' . $id . '/new'));
     $this->breadcrumbs->generate();
     return View::make('home.category')->with('links', $results)->with('resultCategory', $result)->with('id', $id);
 }
예제 #10
0
 /**
  * formのバリデーションチェック(テスト)
  * エラーがあるとtrueを返す
  *
  * @param
  */
 function formValidate($form, $data)
 {
     $error = array();
     //検索画面関連
     if (!isset($data['search_staff_cd'])) {
         $error[] = "検索時の社員CDが取得できませんでした。";
     }
     if (!isset($data['search_name'])) {
         $error[] = "検索時の社員名が取得できませんでした。";
     }
     if (!isset($data['search_department_cd'])) {
         $error[] = "検索時の本部CDが取得できませんでした。";
     }
     if (!isset($data['search_division_cd'])) {
         $error[] = "検索時の部CDが取得できませんでした。";
     }
     if (!isset($data['search_section_cd'])) {
         $error[] = "検索時の課・支店CDが取得できませんでした。";
     }
     if (!isset($data['search_target_year'])) {
         $error[] = "検索時の対象年が取得できませんでした。";
     }
     //初期遷移のみ
     if ($form == "edit") {
         //社員IDを確認
         if (!isset($data['edit_id'])) {
             $error[] = "編集対象の社員IDが取得できませんでした。";
         } elseif (emp($data['edit_id']) || !preg_match("/^\\d{1,10}\$/", $data['edit_id'])) {
             $error[] = "編集対象のIDが不正です。";
         }
         //初期遷移以外
     } else {
         //社員IDを確認
         if (!isset($data['id'])) {
             $error[] = "社員IDが取得できませんでした。";
         } elseif (emp($data['id']) || !preg_match("/^\\d+\$/", $data['id'])) {
             $error[] = "IDが不正です。";
         }
         //社員CDを確認
         if (!isset($data['staff_cd'])) {
             $error[] = "社員CDが取得できませんでした。";
         } elseif (!emp($data['staff_cd']) && !preg_match("/^\\d+\$/", $data['staff_cd'])) {
             $error[] = "社員CDが不正です。";
         }
         //対象年度を確認
         if (!isset($data['target_year'])) {
             $error[] = "対象年度が取得できませんでした。";
         } elseif (!emp($data['target_year']) && !preg_match("/^\\d{4}\$/", $data['target_year'])) {
             $error[] = "対象年度が不正です。";
         }
         //社員名を確認
         if (!isset($data['name'])) {
             $error[] = "社員名が取得できませんでした。";
         }
         //社員名カナを確認
         if (!isset($data['name_kana'])) {
             $error[] = "社員名カナが取得できませんでした。";
         }
         //性別を確認
         if (!isset($data['sex'])) {
             $error[] = "性別が取得できませんでした。";
         }
         //メールアドレスを確認
         if (!isset($data['mail'])) {
             $error[] = "メールアドレスが取得できませんでした。";
         } elseif (!emp($data['mail']) && !preg_match('|^([\\w])+([\\w\\._-])*\\@([\\w])+([\\w\\._-])*\\.([a-zA-Z])+$|', $data['mail'])) {
             $errors[] = "メールアドレスが不正です。";
         }
         //本部CDを確認
         if (!isset($data['department_cd'])) {
             $error[] = "本部CDが取得できませんでした。";
         }
         //部CDを確認
         if (!isset($data['division_cd'])) {
             $error[] = "部CDが取得できませんでした。";
         }
         //課・支店CDを確認
         if (!isset($data['section_cd'])) {
             $error[] = "課・支店CDが取得できませんでした。";
         }
         //職種CDを確認
         if (!isset($data['occupation_cd'])) {
             $error[] = "職種CDが取得できませんでした。";
         }
         //職種名を確認
         if (!isset($data['occupation'])) {
             $error[] = "職種名が取得できませんでした。";
         }
         /*
                     //社員CDを確認
                     if ( !isset($data['staff_cd']) && emp($data['staff_cd'])){
                         $error[] = "社員CDが取得できませんでした。";
                     } elseif( !preg_match("/^\d+$/", $data['staff_cd']) ) {
                         $error[] = "社員CDが不正です。";
                     }
         
                     //対象年度を確認
                     if ( !isset($data['target_year']) && emp($data['target_year']) ){
                         $error[] = "対象年度が取得できませんでした。";
                     } elseif( !preg_match("/^\d{4}$/", $data['target_year']) ) {
                         $error[] = "対象年度が不正です。";
                     }
         
                     //社員名を確認
                     if ( !isset($data['name']) && emp($data['name']) ){
                         $error[] = "社員名が取得できませんでした。";
                     }
         
                     //社員名カナを確認
                     if ( !isset($data['name_kana']) && emp($data['name_kana']) ){
                         $error[] = "社員名カナが取得できませんでした。";
                     }
         
                     //性別を確認
                     if ( !isset($data['sex']) && emp($data['sex']) ){
                         $error[] = "性別が取得できませんでした。";
                     }
         
                     //メールアドレスを確認
                     if ( !isset($data['mail']) && emp($data['mail']) ){
                         $error[] = "メールアドレスが取得できませんでした。";
                     } elseif ( !preg_match('|^[0-9a-z_./?-]+@([0-9a-z-]+\.)+[0-9a-z-]+$|', $data['mail']) ) {
                         $errors[] = "メールアドレスが不正です。";
                     }
         
                     //本部CDを確認
                     if ( !isset($data['department_cd']) && emp($data['department_cd']) ){
                         $error[] = "本部CDが取得できませんでした。";
                     }
         
                     //部CDを確認
                     if ( !isset($data['division_cd']) && emp($data['division_cd']) ){
                         $error[] = "部CDが取得できませんでした。";
                     }
         
                     //課・支店CDを確認
                     if ( !isset($data['section_cd']) && emp($data['section_cd']) ){
                         $error[] = "課・支店CDが取得できませんでした。";
                     }
         
                     //職種CDを確認
                     if ( !isset($data['occupation_cd']) && emp($data['occupation_cd']) ){
                         $error[] = "職種CDが取得できませんでした。";
                     }
         
                     //職種名を確認
                     if ( !isset($data['occupation']) && emp($data['occupation']) ){
                         $error[] = "職種名が取得できませんでした。";
                     }
         */
         //権限を確認
         if (isset($data['group_cd'])) {
             if (is_array($data['group_cd']) && in_array(ACCOUNT_NEW_EMP, $data['group_cd']) && count($data['group_cd']) > 1) {
                 $error[] = "新入社員権限は他の権限と併用できません。";
             }
         }
         //退職フラグを確認
         if (isset($data['retire_flg']) && !preg_match("/^\\d\$/", $data['retire_flg'])) {
             $error[] = "退職フラグ指定値が不正です。";
         }
         //件数分の判定処理
         $cnt = 0;
         for ($i = 0; $i < 3; $i++) {
             //トレーナー確認
             if (isset($data["department_cd_trainer{$i}"]) && !emp($data["department_cd_trainer{$i}"])) {
                 if (!isset($data["user_id_trainer{$i}"]) || emp($data["user_id_trainer{$i}"])) {
                     $error[] = "担当OJTトレーナー" . ($i + 1) . "人目の「トレーナー名」が選択されていません。";
                 }
             }
             //責任者確認
             /*
                             if( isset($data["department_cd_admin{$i}"]) && !emp( $data["department_cd_admin{$i}"] ) ){
                                 if( !isset($data["user_id_admin{$i}"]) || emp( $data["user_id_admin{$i}"] ) ){
                                     $error[] = "担当OJT責任者".($i+1)."人目の「責任者名」が選択されていません。";
                                 }
                             }
             */
             //責任者所属選択あり、責任者名選択なし/期間指定なし
             if (isset($data["department_cd_admin{$i}"]) && !emp($data["department_cd_admin{$i}"])) {
                 if (!isset($data["user_id_admin{$i}"]) || emp($data["user_id_admin{$i}"])) {
                     $error[] = "担当OJT責任者" . ($i + 1) . "人目の「責任者名」が選択されていません。";
                 }
                 if (!isset($data["start_date_admin{$i}"]) || emp($data["start_date_admin{$i}"])) {
                     $error[] = "担当OJT責任者" . ($i + 1) . "人目の「担当開始日」を入力されていません。";
                 }
                 if (!isset($data["end_date_admin{$i}"]) || emp($data["end_date_admin{$i}"])) {
                     $error[] = "担当OJT責任者" . ($i + 1) . "人目の「担当終了日」を入力されていません。";
                 }
             }
             //責任者紐付き期間確認
             //半角数字8桁・正しい日付けか
             if (isset($data["start_date_admin{$i}"]) && !emp($data["start_date_admin{$i}"])) {
                 $year = getYear($data["start_date_admin{$i}"]);
                 $month = getMonth($data["start_date_admin{$i}"]);
                 $day = getDays($data["start_date_admin{$i}"]);
                 if (!preg_match("/^\\d{8}\$/", $data["start_date_admin{$i}"])) {
                     $error[] = "担当OJT責任者" . ($i + 1) . "人目の「担当開始日」は半角数字8桁で入力してください。";
                 } elseif (!checkdate($month, $day, $year)) {
                     $error[] = "担当OJT責任者" . ($i + 1) . "人目の「担当開始日」が不正です。";
                 }
             }
             if (isset($data["end_date_admin{$i}"]) && !emp($data["end_date_admin{$i}"])) {
                 $year = getYear($data["end_date_admin{$i}"]);
                 $month = getMonth($data["end_date_admin{$i}"]);
                 $day = getDays($data["end_date_admin{$i}"]);
                 if (!preg_match("/^\\d{8}\$/", $data["end_date_admin{$i}"])) {
                     $error[] = "担当OJT責任者" . ($i + 1) . "人目の「担当終了日」は半角数字8桁で入力してください。";
                 } elseif (!checkdate($month, $day, $year)) {
                     $error[] = "担当OJT責任者" . ($i + 1) . "人目の「担当終了日」が不正です。";
                 }
             }
             if (isset($data["start_date_admin{$i}"]) && !emp($data["start_date_admin{$i}"]) && isset($data["end_date_admin{$i}"]) && !emp($data["end_date_admin{$i}"])) {
                 //開始日が終了日より過去か
                 if ($data["start_date_admin{$i}"] > $data["end_date_admin{$i}"]) {
                     $error[] = "担当OJT責任者" . ($i + 1) . "人目の「担当開始日」は「担当終了日」より過去を入力してください。";
                 }
             }
             if (isset($data["start_date_admin{$i}"]) && !emp($data["start_date_admin{$i}"]) || isset($data["end_date_admin{$i}"]) && !emp($data["end_date_admin{$i}"])) {
                 //責任者所属選択なし、期間指定あり
                 if (!isset($data["department_cd_admin{$i}"]) || emp($data["department_cd_admin{$i}"])) {
                     $error[] = "担当OJT責任者" . ($i + 1) . "人目の所属部署が選択されていません。";
                 }
                 //責任者名選択なし、期間指定あり
                 if (!isset($data["user_id_admin{$i}"]) || emp($data["user_id_admin{$i}"])) {
                     $error[] = "担当OJT責任者" . ($i + 1) . "人目の「責任者名」が選択されていません。";
                 }
             }
         }
     }
     // チェック結果を返す
     if (count($error) > 0) {
         return $error;
     } else {
         return false;
     }
 }
예제 #11
0
 public function calendrierpetitAction()
 {
     $_blockID = $this->_request->getParam('BlockID');
     $this->view->BlockID = $_blockID;
     if ($this->_isXmlHttpRequest) {
         $_year = $this->_request->getParam('Year');
         $_month = $this->_request->getParam('Month');
         $eventsObject = new EventsCollection($_blockID);
         $events = $eventsObject->getListYearMonth($_year, $_month, null);
         $details_page = Cible_FunctionsCategories::getPagePerCategoryView($eventsObject->getBlockParam('1'), 'details');
         $detail_page = $this->view->baseUrl() . '/' . $details_page . "/";
         $responseObject = array();
         $resultObject = array();
         foreach ($events as $key => $result) {
             //$date = new Zend_Date($result['EDR_StartDate'],null, (Zend_Registry::get('languageSuffix') == 'fr' ? 'fr_CA' : 'en_CA'));
             //$date_string_url = Cible_FunctionsGeneral::dateToString($date,Cible_FunctionsGeneral::DATE_SQL,'-');
             $resultObject['EventID'] = $result['ED_ID'];
             $resultObject['Title'] = strip_tags(utf8_encode($result['EI_Title']));
             $resultObject['Description'] = strip_tags($result['EI_Brief']);
             //$resultObject['URL'] =  $this->baseUrl() . '/' . $this->details_page . "/"  . $date_string_url . "/" . $event['EI_ValUrl'];
             $date_string = '';
             $strd = '';
             foreach ($result['dates'] as $keydate => $row) {
                 //$resultObject['StartDate'] = $row['EDR_StartDate'];
                 //$resultObject['EndDate'] = $row['EDR_EndDate'];
                 $startDate = new Zend_Date($row['EDR_StartDate'], null, 'fr_CA');
                 $endDate = new Zend_Date($row['EDR_EndDate'], null, 'fr_CA');
                 $date_stringURL = sprintf("%d-%d-%d", $startDate->get(Zend_Date::DAY), $startDate->get(Zend_Date::MONTH), $startDate->get(Zend_Date::YEAR));
                 if (!empty($date_string)) {
                     $date_string .= ' et ';
                 }
                 if ($startDate->get(Zend_Date::MONTH) == $endDate->get(Zend_Date::MONTH) && $startDate->get(Zend_Date::YEAR) == $endDate->get(Zend_Date::YEAR)) {
                     if ($startDate->get(Zend_Date::DAY) != $endDate->get(Zend_Date::DAY)) {
                         $date_string .= sprintf("%d-%d %s %d", $startDate->get(Zend_Date::DAY), $endDate->get(Zend_Date::DAY), $startDate->get(Zend_Date::MONTH_NAME), $startDate->get(Zend_Date::YEAR));
                     } else {
                         $date_string .= sprintf("%d %s %d", $startDate->get(Zend_Date::DAY), $startDate->get(Zend_Date::MONTH_NAME), $startDate->get(Zend_Date::YEAR));
                     }
                 } else {
                     $date_string .= sprintf("%d %s %d au %d %s %d", $startDate->get(Zend_Date::DAY), $startDate->get(Zend_Date::MONTH_NAME), $startDate->get(Zend_Date::YEAR), $endDate->get(Zend_Date::DAY), $endDate->get(Zend_Date::MONTH_NAME), $endDate->get(Zend_Date::YEAR));
                 }
                 //list($a, $m, $j) = explode("-", $row['EDR_StartDate']);
                 //$resultObject['CellId'] = $m . $j . $a;
                 $arrayDates = getDays($row['EDR_StartDate'], $row['EDR_EndDate']);
                 if ($strd != "") {
                     $strd .= "|";
                 }
                 $strd .= implode("|", $arrayDates);
                 //var_dump($resultObject);
             }
             $resultObject['URL'] = $detail_page . $date_stringURL . "/" . $result['EI_ValUrl'];
             $resultObject['DateComplete'] = utf8_encode($date_string);
             $resultObject['CellsIds'] = $strd;
             array_push($responseObject, $resultObject);
         }
         //var_dump($responseObject);
         $this->getHelper('viewRenderer')->setNoRender();
         echo json_encode($responseObject);
     }
 }
예제 #12
0
===

Grabs stock symbol from database using getSymbol function
Gets history of stock from getHistory function
Does slope analysis using getSlope function

Starts with 120 days and keeps going until 2500 days

***/
# Put stuff in a log
$log = new Loggy();
$log->lfile('logstock.log');
# Delete previous slope data
deleteSlopeData();
# minimum trading days for slope analysis
$ntd = 120;
# look up stocks in stock_symbol_name table
$stocks = getSymbol();
foreach ($stocks as $stock) {
    $symbol = $stock['symbol'];
    # look up # of trading days stock traded
    $days = getDays($symbol);
    if ($days === 0 || $days < 500) {
        continue;
    } else {
        getRecursive($symbol, $ntd);
    }
    //else days
}
//foreach stocks
예제 #13
0
            $arr['friday'] = getdate($friday);
            $saturday = $time + 60 * 60 * 24 * 0;
            $arr['saturday'] = getdate($saturday);
            $sunday = $time + 60 * 60 * 24 * 1;
            $arr['sunday'] = getdate($sunday);
            break;
        case 0:
            // sunday
            $monday = $time - 60 * 60 * 24 * 6;
            $arr['monday'] = getdate($monday);
            $tuesday = $time - 60 * 60 * 24 * 5;
            $arr['tuesday'] = getdate($tuesday);
            $wednesday = $time - 60 * 60 * 24 * 4;
            $arr['wednesday'] = getdate($wednesday);
            $thursday = $time - 60 * 60 * 24 * 3;
            $arr['thursday'] = getdate($thursday);
            $friday = $time - 60 * 60 * 24 * 2;
            $arr['friday'] = getdate($friday);
            $saturday = $time - 60 * 60 * 24 * 1;
            $arr['saturday'] = getdate($saturday);
            $sunday = $time + 60 * 60 * 24 * 0;
            $arr['sunday'] = getdate($sunday);
            break;
    }
    return $arr;
}
$Week = getDays(time() + 60 * 60 * 24 * 2);
foreach ($Week as $key => $value) {
    echo $Week[$key]['mday'] . " - " . $Week[$key]['mon'] . " - " . $Week[$key]['year'];
    echo "<br>";
}