//$dateto="2015-07-25"; if ($searchterm == "") { if ($searchname) { $criteria = "and (User_Name like '%{$searchname}%' or User_Department like '%{$searchname}%' or User_Nationality like '%{$searchname}%') "; } } else { $criteria = "and ({$searchterm} like '%{$searchname}%')"; } if ($adminstatus == 'Y') { $criteria = "where (User_Id>0) " . $criteria; } else { $criteria = "where (User_Id='{$User_Id}' or User_ManagerId='{$User_Id}' or User_SupervisorId='{$User_Id}')" . $criteria; } $col = (strtotime($dateto) - strtotime($datefrom)) / 86400; $col2 = $col + 6; $dateRange = getDateRange($datefrom, $dateto); $qryuserprofile = mysql_query("select * from ncr_user {$criteria} and (User_JoiningDate<='{$dateto}') and ((User_LeavingDate>='{$datefrom}') or(User_LeavingDate='0000-00-00')) order by User_JoiningDate"); $e = 0; while ($objuserprofile = mysql_fetch_object($qryuserprofile)) { $userids[$e] = $objuserprofile->User_Id; $attendacecard[$objuserprofile->User_Id] = $objuserprofile->User_AttenId; $User_Name[$objuserprofile->User_Id] = $objuserprofile->User_Name; $grade[$objuserprofile->User_Id] = $objuserprofile->User_Grade; //echo "name-".$name[$objuserprofile->User_Id]; $dept[$objuserprofile->User_Id] = $objuserprofile->User_Department; $nationality[$objuserprofile->User_Id] = $objuserprofile->User_Nationality; $workdur[$objuserprofile->User_Id] = $objuserprofile->User_WorkHours; $e++; } echo "<table class='tableaddp' border='1' cellspacing='0' cellpadding='0'>"; echo "<tr><td colspan={$col2}><form name='attendancelist' action='attendancelist.php' method='post'><table class='tableaddp'><tr><td>From <input type='date' name='datefrom' value='{$datefrom}'/> To <input type='date' name='dateto' value='{$dateto}'/>";
/** * Inserts a linked list to the archives. * * @param array $params * @param object $smarty * @return string */ function smarty_archive_list($params, &$smarty) { global $Archive_array, $PIVOTX; $params = cleanParams($params); $Current_weblog = getDefault($params['weblog'], $PIVOTX['weblogs']->getCurrent()); $format = getDefault($params['format'], "<a href=\"%url%\">%st_day% %st_monname% - %en_day% %en_monname% %st_year% </a><br />"); $unit = getDefault($params['unit'], "month"); $separator = getDefault($params['separator'], ""); // if not yet done, load / make the array of archive filenames (together // with at least one date) if (!isset($Archive_array)) { makeArchiveArray(false, $unit); } // If we use 'isactive', set up the $active_arc and $isactive vars. if (!empty($params['isactive'])) { $active_arc = $pagetype = $PIVOTX['parser']->modifier['archive']; $isactive = $params['isactive']; } else { $isactive = ""; } $output = array(); if (is_array($Archive_array[$Current_weblog])) { // maybe flip and reverse it. if ($params['order'] == 'descending' || $params['order'] == 'desc') { $mylist = $Archive_array[$Current_weblog]; } else { $mylist = array_reverse($Archive_array[$Current_weblog]); } // Iterate over the list, formatting output as we go. $counter = 0; foreach ($mylist as $date) { $counter++; $filelink = makeArchiveLink($date, $unit, $params['weblog']); // Check if the current archive is the 'active' one. if (!empty($isactive) && makeArchiveName($date, '', $unit) == $active_arc) { $thisactive = $isactive; } else { $thisactive = ""; } // fix the rest of the string.. list($start_date, $stop_date) = getDateRange($date, $unit); $this_output = formatDateRange($start_date, $stop_date, $format); $this_output = str_replace("%counter%", $counter, $this_output); $this_output = str_replace("%url%", $filelink, $this_output); $this_output = str_replace("%active%", $thisactive, $this_output); $output[] = "\n" . $this_output; } } return implode($separator, $output); }
function displayAnalytics() { global $users, $userID, $userName, $videoID, $authorizedUsers, $classes, $classID; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Video Usage Analytics</title> <script type="text/javascript" src="kaltura-html5player-widget/jquery-1.4.2.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $('#date-heatmap .day').mouseover(function(event) { // the date and number of views (delineated by an underscore) are stored in the class tag var classTag = $(this).attr('class'); underscorePos = classTag.indexOf("_"); viewDate = classTag.substring(0, underscorePos); viewCount = classTag.substring(underscorePos+1, classTag.indexOf(" ")); if ("" == viewCount) viewCount = 0; $('<div id="date" style="border:1px solid gray;background-color:#fff;padding:2px 4px 2px 4px;width:auto;z-index:100;">' + viewDate + ' (' + viewCount + ' views)<br style="margin-bottom:10px;"/></div>').appendTo('body'); showDate(event); }); function showDate(event) { var tPosX = event.pageX + 15 + 'px'; var tPosY = event.pageY + 15 + 'px'; $('#date').css({'position': 'absolute', 'top': tPosY, 'left': tPosX}); } $('#date-heatmap .day').mouseout(function(event) { $('#date').remove(); }); }); </script> <link rel="stylesheet" type="text/css" href="style.css" /> <link rel="stylesheet" type="text/css" href="admin-page.css" /> </head> <body> <?php printAdminBar(false, $userName); ?> <div style="clear:both"></div> <strong>Video Usage Analytics</strong> <br /> <br /> <label align="left">select course <select name="class" id="class" onchange="jumpBoxClass()"> <?php //print "classID: $classID"; foreach ($classes as $class) { //print_r($class); $ID = $class['ID']; $name = $class['name']; $classID == $ID ? $selected = "selected=\"selected\"" : ($selected = ""); print "\t<option value=\"{$ID}\" {$selected}>{$name}</option>\n"; } ?> </select> </label> <label style="font-size:100%">select video <select> <option>All</option> <?php mysql_connect('localhost', 'root', 'Adelaide160'); mysql_select_db('prod_annotation_tool'); // $query="select title from media where video_id IN (SELECT video_id FROM videoGroup)"; // $query="SELECT m.title FROM videoGroup v, media m WHERE v.group_id=$groupID AND m.video_id LIKE v.video_id ORDER BY m.title"; $media = new media(); print_r($groupIDs); //for ($i=0; $i<count($groupIDs); $i++): //$videoIDs = array_keys($media->getVideosByGroupID($userID,$groupIDs[$i])); //print_r($videoIDs);print "<br />"; $result = mysql_query($query); while ($row = mysql_fetch_array($result)) { echo "<option>"; echo $row['title']; echo "</option>"; } ?> </select> </select> </label> <form id="form1" name="form1" method="post" action="" > <table style="width:800px;height:auto;"> <thead> <tr style="border-bottom:1px solid black"> <th>Video(s)</th> <th>Unique Users</th> <th>% of class</th> <th>Total of Annotations</th> <th>Total of Summaries</th> </tr> </thead> <tbody> <?php $groupIDs = array_keys($users->getGroupsByClassID($classID)); //print_r($groupIDs);print "<br />"; $userInfo = null; $media = new media(); for ($i = 0; $i < count($groupIDs); $i++) { // fetch videos for given group $videoIDs = array_keys($media->getVideosByGroupID($userID, $groupIDs[$i])); //print_r($videoIDs);print "<br />"; for ($j = 0; $j < count($videoIDs); $j++) { $groupMembers = $users->getGroupMembers($groupIDs[$i]); // TODO: cache this info $userInfo = $users->getUserInfo($groupMembers); //print_r($groupMembers);print "<br />"; //print "userInfo: "; print_r($userInfo);print "<br />"; $thumbnail = $media->getProperty($videoIDs[$j], 'thumbnail_url'); $title = $media->getProperty($videoIDs[$j], 'title'); ?> <div style="width:900px;"></div> <?php for ($k = 0; $k < count($groupMembers); $k++) { //array_push($viewerStats, $media->getViewerStatistics($userInfo[$k]['User_ID'], $videoIDs[$j])); //$viewerStats[$k] = $media->getViewerStatistics($userInfo[$k]['User_ID'], $videoIDs[$j]); $playStatus[$k] = $media->getPlayStatistics($videoIDs[$j]); //print_r($viewerStats[$k]); } // find first timestamp and last time stamp $dates = getDateRange($viewerStats); // calculate range and convert it to days $range = intval((strtotime($dates['last_view']) - strtotime($dates['first_view'])) / (60 * 60 * 24)) + 1; $maxDailyViews; $dailyViews = getDailyViews($viewerStats, $maxDailyViews); for ($k = 0; $k < count($groupMembers); $k++) { //print "\$groupMembers[$k]: "; print_r($groupMembers); //print_r($viewerStats); print "<br />"; ?> <tr style="border-bottom:1px solid black"> <?php if (0 == $k) { print "<td style=\"border-right:1px solid black;background-color:#eee;\" rowspan=\"" . count($groupMembers) . "\"><img src=\"{$thumbnail}\" alt=\"video thumbnail\" /><br />{$title}<br /></td>"; echo "<td>"; echo $media->getUniqueUsers($videoIDs[$j]); echo "</td>"; echo "<td>"; echo round($media->getUniqueUsers($videoIDs[$j]) / $media->getNumAnnotations($videoIDs[$j]) * 100 / 2, 2); echo "</td>"; echo "<td>" . $media->getNumAnnotations($videoIDs[$j]) . "</td>"; echo "<td>" . $media->getNumSummaries($videoIDs[$j]) . "</td>"; } ?> <?php } } } $media->close(); ?> </tr> <br /> </tbody> </table> </form> </body> </html> <?php }