$smarty->assign('CALENDAR_SETTINGS', $Calendar_Settings); $c_mod_strings = return_specified_module_language($current_language, "Calendar"); $smarty->assign('CMOD', $c_mod_strings); $smarty->assign('MODULE', $currentModule); // TODO: Update Single Module Instance name here. $smarty->assign('SINGLE_MOD', 'SINGLE_' . $currentModule); $smarty->assign('CATEGORY', $category); $smarty->assign("THEME", $theme); $smarty->assign('IMAGE_PATH', "themes/{$theme}/images/"); $smarty->assign('ID', $focus->id); $smarty->assign('MODE', $focus->mode); $viewBox = 'hourview'; if ($Calendar4You->CheckPermissions("EDIT")) { $smarty->assign('EDIT', 'permitted'); $hour_startat = timeString(array('hour' => date('H:i', time() + 5 * 60), 'minute' => 0), '24'); $hour_endat = timeString(array('hour' => date('H:i', time() + 60 * 60), 'minute' => 0), '24'); $time_arr = getaddITSEventPopupTime($hour_startat, $hour_endat, $Calendar_Settings["hour_format"]); $date = new DateTimeField(null); //To get date in user selected format $temp_date = $date->getDisplayDate(); if ($current_user->column_fields['is_admin'] == 'on') { $Res = $adb->pquery("select * from vtiger_activitytype", array()); } else { $roleid = $current_user->roleid; $subrole = getRoleSubordinates($roleid); if (count($subrole) > 0) { $roleids = $subrole; array_push($roleids, $roleid); } else { $roleids = $roleid; }
function generatePDFByResult($result, $targetDirectory, $sectionheader, $extrainfo = "PDF output") { global $config; $body_string = ""; while ($row = mysql_fetch_row($result)) { $body_string .= latexAppendQuestion($row[0], $row[1], $row[2], $row[3]); } if ($body_string == "") { $body_string = "No content in this application."; } if (substr($targetDirectory, -1) != "/") { //add trailing slash if not present $targetDirectory .= "/"; } //make a new file for this submission do { $outFile = uid(32); } while (file_exists($targetDirectory . $outFile)); //make temporary directory to store the output file mkdir($targetDirectory . $outFile . "/"); $fin = fopen($targetDirectory . "template.tex", 'r'); $fout = fopen($targetDirectory . $outFile . "/" . $outFile . ".tex", 'w'); while ($line = fgets($fin)) { $line = str_replace('$TIME$', timeString(), $line); $line = str_replace('$EXTRAINFO$', $extrainfo, $line); $line = str_replace('$ORGANIZATION$', $config['organization_name'], $line); $line = str_replace('$SECTIONNAME$', $sectionheader, $line); $line = str_replace('$BODY$', $body_string, $line); fwrite($fout, $line); } fclose($fin); fclose($fout); //make the PDF $config = $GLOBALS['config']; $cdCommand = "cd " . $targetDirectory . $outFile; $pdfCommand = $config['latex_path'] . " --interaction=nonstopmode " . $outFile . ".tex"; //execute pdf twice for lastpage to work (page # out of n) exec($cdCommand . " && " . $pdfCommand . " && " . $pdfCommand); if (!file_exists($targetDirectory . $outFile . "/" . $outFile . ".pdf")) { //failed; PDF not created //delete temp directory //delete_directory($targetDirectory . $outFile); //no trailing slash on outFile return array(FALSE, "generation failure"); } //move the PDF and delete temporary directory rename($targetDirectory . $outFile . "/" . $outFile . ".pdf", $targetDirectory . $outFile . ".pdf"); delete_directory($targetDirectory . $outFile); //no trailing slash on outFile return array(TRUE, $outFile); }
function get_page($page, $context, $args = array()) { //let pages use some variables extract($args); $config = $GLOBALS['config']; $timeString = timeString(); $basePath = basePath(); if (!isset($service_id)) { $service_id = -1; } //figure out what tabs to display in navbar if ($context == "main") { $navbar = array(); } else { if ($context == "ghost") { $navbar = array("./?id={$service_id}" => "Status", "config.php?id={$service_id}" => "Configuration", "map.php?id={$service_id}" => "Maps", "mapcfg.php?id={$service_id}" => "Map configurations", "log.php?id={$service_id}" => "Log", "replay.php?id={$service_id}" => "Replays", '../panel/' => 'Back to panel', '../panel/index.php?action=logout' => "Logout"); } else { if ($context == "channel") { $navbar = array("./?id={$service_id}" => "Status", "config.php?id={$service_id}" => "Configuration", "log.php?id={$service_id}" => "View log", '../panel/' => 'Back to panel', '../panel/index.php?action=logout' => "Logout"); } else { if ($context == "panel") { $navbar = array('./' => "Home", 'account.php' => "Account", 'services.php' => "Services", 'announce.php' => "Announcements", 'index.php?action=logout' => "Logout"); } else { if ($context == "database") { $navbar = array("./?id={$service_id}" => "Home", "current.php?id={$service_id}" => 'Running games', "games.php?id={$service_id}" => 'Game log', "bans.php?id={$service_id}" => 'Bans', "admins.php?id={$service_id}" => 'Admins', "execute.php?id={$service_id}" => "Execute command", "cron.php?id={$service_id}" => "Cron", '../panel/' => 'Back to panel', '../panel/index.php?action=logout' => "Logout"); } else { if ($context == "minecraft") { $navbar = array("./?id={$service_id}" => "Status", "config.php?id={$service_id}" => "Configuration", "plugin.php?id={$service_id}" => "Plugins", "backup.php?id={$service_id}" => "Backups", "log.php?id={$service_id}" => "Log", "version.php?id={$service_id}" => "Server version", '../panel/' => 'Back to panel', '../panel/index.php?action=logout' => "Logout"); } else { if ($context == "garena") { $navbar = array("./?id={$service_id}" => "Status", "config.php?id={$service_id}" => "Configuration", "log.php?id={$service_id}" => "View log", '../panel/' => 'Back to panel', '../panel/index.php?action=logout' => "Logout"); } else { if ($context == "admin") { $navbar = array('./' => "Home", 'accounts.php' => "Accounts", 'status.php' => "Status", 'announce.php' => "Announcements", 'search.php' => "Search", 'index.php?action=logout' => "Logout"); } else { //oops, context should be one of the above return; } } } } } } } } include "{$basePath}/style/header.php"; include "{$basePath}/style/{$context}/{$page}.php"; include "{$basePath}/style/footer.php"; }
//lets do this properly if ($date_diff > 0) { //get all requests $query = "SELECT\r\n request.request_date,request.user_id,users.email,users.picture_name\r\n FROM\r\n request\r\n LEFT JOIN\r\n users\r\n ON\r\n request.user_id = users.user_id\r\n WHERE\r\n request.election_id = '{$election_id}'"; $all_request = $connection1->prepare($query); $all_request->execute(); $all_request->setFetchMode(PDO::FETCH_ASSOC); $all_request = $all_request->fetchAll(); if (count($all_request) > 0) { $request_count = count($all_request); for ($i = 0; $i < $request_count; $i++) { $sender_id = $all_request[$i]["user_id"]; $sender_email = $all_request[$i]["email"]; //separate the day from the time $request_day = explode(" ", $all_request[$i]["request_date"])[0]; $request_time = timeString(explode(" ", $all_request[$i]["request_date"])[1]); if ($all_request[$i]["picture_name"] != null) { $img_url = '../images/users/' . $all_request[$i]["picture_name"]; } else { $img_url = '../images/male.gif'; } $specification = $sender_id . '_' . $election_id; $request_string .= '<li class="row '; $request_string .= $specification; $request_string .= '" id="' . $sender_id . '"> <span class="col-xs-2"> <img class="img-circle preview" src="' . $img_url . '" alt="hey" width="100%" height="100%" > </span> <div class="col-xs-10" id="' . $date_diff . '"> <span class="col-xs-8 email">'; $request_string .= $sender_email;
//no pagename given echo "No page field found"; } } if ($showindex) { //show index //ARROW makes a database connection to the mysql database (which is from now on the default one) connect_db(); $pagesquery = "SELECT pagename, MAX(version) AS version, MAX(lastmodified) AS lastmodified FROM {$wikitable} GROUP BY pagename"; $pagesresult = mysql_query($pagesquery) or die("Error getting pages: " . mysql_error()); //echo the table echo "<table>\n"; echo "<tr>\n"; echo "<th>Name</th><th>view</th><th>Version</th><th>LastUpdate</th>\n"; echo "</tr>\n"; while ($row = mysql_fetch_assoc($pagesresult)) { $name = $row['pagename']; $time = timeString($row['lastmodified']); $version = $row['version']; echo "<tr>\n"; echo "<td><a href=\"wikiadmin.php?function=details&page=" . urlencode($name) . "\">" . htmlspecialchars($name) . "</a></td>\n"; //ARROW ../wiki.php?id= is the base of the link to the added wiki page. echo "<td><a target=\"_blank\" href=\"{$wikiurl}?id=" . urlencode($name) . "\">view</a></td>\n"; echo "<td>" . $version . "</td>\n"; echo "<td>" . $time . "</td>\n"; echo "</tr>\n"; } echo "</table>\n"; } //ARROW closes all html of the header.php include 'footer.php';
/** * Function creates HTML To display events in month view * @param array $cal - collection of objects and strings * @param string $slice - date(eg: 2006-07-13) * returns string $eventlayer - hmtl in string format */ function getmonthEventLayer(&$cal, $slice) { global $mod_strings, $cal_log, $adb, $current_user, $theme; $category = getParentTab(); $cal_log->debug("Entering getmonthEventLayer() method..."); $eventlayer = ''; $arrow_img_name = ''; $act = $cal['calendar']->month_array[$slice]->activities; if (!empty($act)) { $no_of_act = count($act); if ($no_of_act > 2) { $act_row = 2; $remin_list = $no_of_act - $act_row; } else { $act_row = $no_of_act; $remin_list = null; } for ($i = 0; $i < $act_row; $i++) { $arrow_img_name = 'event' . $cal['calendar']->month_array[$slice]->start_time->hour . '_' . $i; $id = $act[$i]->record; $subject = $act[$i]->subject; if (strlen($subject) > 10) { $subject = substr($subject, 0, 10) . "..."; } $format = $cal['calendar']->hour_format; $start_hour = timeString($act[$i]->start_time, $format); $end_hour = timeString($act[$i]->end_time, $format); $account_name = $act[$i]->accountname; $image = vtiger_imageurl($act[$i]->image_name, $theme); $color = $act[$i]->color; //Added for User Based Customview for Calendar Module $visibility_query = $adb->pquery('SELECT visibility from vtiger_activity where activityid=?', array($id)); $visibility = $adb->query_result($visibility_query, 0, 'visibility'); $user_query = $adb->pquery("SELECT vtiger_crmentity.smownerid,vtiger_users.user_name from vtiger_crmentity,vtiger_users where crmid=? and vtiger_crmentity.smownerid=vtiger_users.id", array($id)); $userid = $adb->query_result($user_query, 0, "smownerid"); $username = $adb->query_result($user_query, 0, "user_name"); $assigned_role_query = $adb->pquery("select roleid from vtiger_user2role where userid=?", array($userid)); $assinged_role_id = $adb->query_result($assigned_role_query, 0, "roleid"); $role_list = $adb->pquery("SELECT * from vtiger_role WHERE parentrole LIKE '" . formatForSqlLike($current_user->column_fields['roleid']) . formatForSqlLike($assinged_role_id) . "'", array()); $is_shared = $adb->pquery("SELECT * from vtiger_sharedcalendar where userid=? and sharedid=?", array($userid, $current_user->id)); if ($current_user->column_fields['is_admin'] != 'on' && $adb->num_rows($role_list) == 0 && ($adb->num_rows($is_shared) == 0 && ($visibility == 'Public' || $visibility == 'Private') || $visibility == 'Private') && $current_user->id != $userid) { $eventlayer .= '<div class ="event" id="event_' . $cal['calendar']->month_array[$slice]->start_time->hour . '_' . $i . '"> <nobr><img src="' . $image . '" border="0"></img> ' . $username . ' - ' . $mod_strings["LBL_BUSY"] . '</nobr> </div><br>'; } else { $eventlayer .= '<div class ="event" id="event_' . $cal['calendar']->month_array[$slice]->start_time->hour . '_' . $i . '"> <nobr><img src="' . $image . '" border="0"></img> <a href="index.php?action=DetailView&module=Calendar&record=' . $id . '&activity_mode=Events&viewtype=calendar&parenttab=' . $category . '"><span class="orgTab">' . $start_hour . ' - ' . $end_hour . '</span></a></nobr> </div><br>'; } } if ($remin_list != null) { $eventlayer .= '<div valign=bottom align=right width=10%> <a href="index.php?module=Calendar&action=index&view=' . $cal['calendar']->month_array[$slice]->getView() . '&' . $cal['calendar']->month_array[$slice]->start_time->get_date_str() . '&parenttab=' . $category . '" class="webMnu"> +' . $remin_list . ' ' . $mod_strings['LBL_MORE'] . '</a></div>'; } $cal_log->debug("Exiting getmonthEventLayer() method..."); return $eventlayer; } }
?> "><?php echo $user_id; ?> </a></p></td> <td class="top_border"><p><a href="user_detail.php?id=<?php echo $user_id; ?> "><?php echo $infoUser[2]; ?> </a></p></td></a> <td class="top_border"><p><?php echo $infoUser[0]; ?> </p></td></a> <td class="top_border"><p><?php echo $infoUser[1]; ?> </p></td> <td class="top_border"><p><?php echo timeString($user[0]); ?> </p></td> <td class="top_border"><input type="submit" name="action" value="reset"></td> <td class="top_border"><input type="submit" name="action" value="delete!!"></td> </tr></form> <? } ?> </table>
echo $dummy2; ?> " style="display: none;"> </div> <span class="error"><?php if (empty($messaging)) { echo $end_date_of_electionErr; } ?> </span><br> </div> <div class="form-group col-xs-12 col-md-6"> <label>End Time of Election</label><br> <div> <d><?php echo timeString($this_election['election_time_to']); ?> </d> </div> <div id="timeEnd" style="display: none"> <div id="elect_time"> <!-- enditime --> <div class="inner cover indexpicker"> <div class="time_pick"><input id="timepicker2" class="form-control" type="text" name="end_time" value="<?php echo $dummy4; ?> "> <div class="timepicker_wrap " style="display: none;"> <div class="time"> <div class="prev action-prev"></div>
"><?php echo $message[4]; ?> </a></td> <td><a href="messaging.php?view=message&box_id=<?php echo $box_id; ?> &message_id=<?php echo $message[0]; ?> "><?php echo $message[5]; ?> </a></td> <td><?php echo timeString($message[6]); ?> </td> </tr> <? } ?> </table> <? } else if($view == "compose") { ?> <form method="post" action="messaging.php?action=send"> To: <input type="text" name="to" value="<?php echo $contents; ?> " /><br /> Subject: <input type="text" name="subject" /><br /> Message: <textarea name="body" rows="7" cols="25"></textarea><br /> <input type="submit" value="Send" />
function page_advanced_include($target, $context, $args = array()) { //let pages use some variables extract($args); $config = $GLOBALS['config']; $timeString = timeString(); if ($context != "apply" && $context != "root" && $context != "admin") { $context = "apply"; //this should never happen } //for admin and root areas, add anti-CSRF strings if needed $t = ''; $t_hidden = ''; $t_get = 't=disabled'; if ($context == "admin" || $context == "root") { if ($config['csrf_token']) { $key = "ais"; if ($context == "root") { $key = "ris"; } $t = $_SESSION['t']; $t_hidden = "<input type=\"hidden\" name=\"{$key}\" value=\"{$t}\" />"; $t_get = "{$key}={$t}"; } } $basePath = basePath(); $style = getStyle(); $stylePath = $basePath . "/astyle/{$style}"; $style_page_include = "{$stylePath}/{$context}/{$target}.php"; $page_include = $basePath . "/page/{$context}/{$target}.php"; if (file_exists($style_page_include)) { include $style_page_include; } else { include $page_include; } }
<input type="radio" name="result_display" value="after" required'; if ($display == 'after') { $status_string .= ' checked'; } $status_string .= '>After Election <input type="radio" name="result_display" value="during" required'; if ($display == 'during') { $status_string .= ' checked'; } $status_string .= '>During Election </div> </div><br>'; $dummy1 = dateString($this_election["election_start_date"]); $dummy2 = dateString($this_election["election_end_date"]); $dummy3 = timeString($this_election["election_time_from"]); $dummy4 = timeString($this_election["election_time_to"]); //php code for the update details if (isset($_POST["update"])) { //retain new inputs for date and time $dummy1 = $_POST["start_date"]; $dummy2 = $_POST["end_date"]; $dummy3 = $_POST["start_time"]; $dummy4 = $_POST["end_time"]; //check name was changed if ($this_election['election_name'] === $_POST["name_of_election"]) { $name_of_election = $this_election['election_name']; } else { $name_of_election = ""; if (empty($_POST["name_of_election"])) { $name_of_electionErr = "Name of election is required"; } else {
$view_news_query->execute(); $view_news_query->setFetchMode(PDO::FETCH_ASSOC); $row = $view_news_query->fetchAll(); for ($i = 0; $i < count($row); $i++) { $adminPhoto = $images_dir . $row1['picture_name']; $date_time1 = explode(" ", $row[$i]['date_created']); $date1 = getDateInterval($date_time1[0]); $time1 = timeString($date_time1[1]); $view_posted_news .= "<div class='me' style='margin-bottom:10px; ' >" . "<br>\n <label style='overflow:hidden;text-overflow:ellipsis;'>" . $row[$i]['news'] . "</label>\n <br>" . $date1 . " " . $time1 . "<br></div>"; } //querying for election name $election_name = $election_details_test = ""; $row = getElectionDetails($election_id)[0]; $election_name .= $row['election_name']; $_SESSION['election_name'] = $election_name; $election_details_test .= "<label>Start Date:</label> " . dateString($row['election_start_date']) . "<br>\n <label>Start Time:</label> " . timeString($row['election_time_from']) . "<br><label>End Date:</label>  " . dateString($row['election_end_date']) . "<br><label>End Time:</label> " . timeString($row['election_time_to']) . "<br>\n <label>Number of Voters: </label> " . count(getAllMembers("joined", ['election_id'], ['election_id', '=', $election_id])) . "<br><label>Number of Contestants: </label> " . count(getAllMembers("contestants", ['contestant_id'], ['election_id', '=', $election_id])); //getting the user_id for a particular election $election_admin_details = $election_admin_detail = ""; $images_dir = "../images/users/"; $user_id_result = $row["user_id"]; //querying to get the admin email $row = getAllMembers("users", ["*"], ["user_id", "=", $user_id_result])[0]; $election_admin_details .= "<div class='col-md-6'><label>Name:</label> " . $row['lname'] . " " . $row['fname'] . "\n <br><label>Username:</label> " . $row['username'] . "<br><label>Email:</label> " . $row['email'] . "<br>\n <label>Telephone:</label> " . $row['phone'] . "</div>"; $election_admin_detail .= "<div class='col-md-4'><img src=" . $images_dir . $row['picture_name'] . " width='120px'\n height='auto' style='border-radius:100%;max-height:200px;' class='preview' id='displayedPhoto'></div>"; //checking for the link vote $hasvoted = hasvoted(user_id($myemail), $election_id); //determining when to make the view profile link visible or not' $checkContestant1 = checkContestant(user_id($myemail), $election_id); if (!empty($checkContestant1)) { $profile1 = "<a href='viewprofile.php' class='active'>View Profile</a>"; } else {
$part3 = explode(':', $election_time_to); $end_hour = $part3[0]; $end_minute = $part3[1]; //getting the election duration $election_end1 = $election_end_date . " " . $election_time_to; $election_end = strtotime($election_end1); $electionStartDateTemp = $election_start_date . " " . $election_time_from; $electionStartDate = convert_date($electionStartDateTemp); //} $string_election = ""; //get number of registered and voted voters $number_registered = count(getAllMembers('joined', ['joined_id'], ['election_id', '=', $election_id])); $number_voted = count(getAllMembers('joined', ['joined_id'], ['election_id', '=', $election_id], 0, 'AND', ['has_voted', '=', 1])); //$string_election.="<div class='col-md-6'><label>Election Start Date:</label> ".dateString($election_start_date)."</div> <div class='col-md-6'><label>Start time: </label> ".timeString($election_time_from)."</div><div class='col-md-6'> <label>Election End Date: </label>". //dateString($election_end_date)."</div> <div class='col-md-6'><label>End time: </label> ".timeString($election_time_to).'</div>'; $string_election .= "<div class='col-md-6'><label>Number of registered voter(s):</label> " . $number_registered . "</div> <div class='col-md-6'><label>Election End Date: </label> " . dateString($election_end_date) . "</div><div class='col-md-6'> <label>Those that have voted: </label>" . $number_voted . "</div> <div class='col-md-6'><label>End time: </label> " . timeString($election_time_to) . '</div>'; $string = ""; //get all posts for this election $allPosts = getAllPosts($election_id); //for each post,get all contestants $postCon = $display = $string_array = $string_result_array = []; //let superIndex retain 1D array of all post $superIndex = []; $image_dir = "../images/contestants/"; for ($i = 0; $i < count($allPosts); $i++) { //let the post by the key to all contestant array in postCon array $postCon[$allPosts[$i]['post']] = getAllContestants($allPosts[$i]['post_id']); //push each post to the superIndex array_push($superIndex, $allPosts[$i]['post']); } //lets go deeper, write Japhet on the wall of eVoting
/** * Function creates HTML to display Todos ListView * @param array $todo_list - collection of strings(Todo Information) * @param array $cal - collection of objects and strings * return string $list_view - html tags in string format */ function constructTodoListView($todo_list, $cal, $subtab, $navigation_array = '') { global $mod_strings, $cal_log, $adb, $theme; $cal_log->debug("Entering constructTodoListView() method..."); global $current_user, $app_strings; $date_format = $current_user->date_format; $format = $cal['calendar']->hour_format; $hour_startat = timeString(array('hour' => date('H:i'), 'minute' => 0), '24'); $hour_endat = timeString(array('hour' => date('H:i', time() + 60 * 60), 'minute' => 0), '24'); $time_arr = getaddEventPopupTime($hour_startat, $hour_endat, $format); $temp_ts = $cal['calendar']->date_time->ts; //to get date in user selected date format $temp_date = $date_format == 'dd-mm-yyyy' ? date('d-m-Y', $temp_ts) : ($date_format == 'mm-dd-yyyy' ? date('m-d-Y', $temp_ts) : ($date_format == 'yyyy-mm-dd' ? date('Y-m-d', $temp_ts) : '')); if ($cal['calendar']->day_start_hour != 23) { $endtemp_date = $temp_date; } else { $endtemp_ts = $temp_ts + 1 * 24 * 60 * 60; $endtemp_date = $date_format == 'dd-mm-yyyy' ? date('d-m-Y', $endtemp_ts) : ($date_format == 'mm-dd-yyyy' ? date('m-d-Y', $endtemp_ts) : ($date_format == 'yyyy-mm-dd' ? date('Y-m-d', $endtemp_ts) : '')); } $list_view = ""; //labels of listview header if ($cal['view'] == 'day') { $colspan = 9; $header = array('0' => '#', '1' => $mod_strings['LBL_TIME'], '2' => $mod_strings['LBL_LIST_DUE_DATE'], '3' => $mod_strings['LBL_TODO']); $header_width = array('0' => '5%', '1' => '10%', '2' => '10%', '3' => '38%'); /*if(getFieldVisibilityPermission('Calendar',$current_user->id,'parent_id') == '0') { array_push($header,$mod_strings['LBL_RELATEDTO']); array_push($header_width,'15%'); } if(getFieldVisibilityPermission('Calendar',$current_user->id,'contact_id') == '0') { array_push($header,$mod_strings['LBL_CONTACT_NAME']); array_push($header_width,'15%'); }*/ if (getFieldVisibilityPermission('Calendar', $current_user->id, 'taskstatus') == '0') { array_push($header, $mod_strings['LBL_STATUS']); array_push($header_width, '10%'); } if (isPermitted("Calendar", "EditView") == "yes" || isPermitted("Calendar", "Delete") == "yes") { array_push($header, $mod_strings['LBL_ACTION']); array_push($header_width, '10%'); } array_push($header, $mod_strings['LBL_ASSINGEDTO']); array_push($header_width, '15%'); } else { $colspan = 10; $header = array('0' => '#', '1' => $mod_strings['LBL_TIME'], '2' => $mod_strings['LBL_START_DATE'], '3' => $mod_strings['LBL_DUE_DATE'], '4' => $mod_strings['LBL_TODO']); $header_width = array('0' => '5%', '1' => '10%', '2' => '10%', '3' => '10%', '4' => '28%'); /*if(getFieldVisibilityPermission('Calendar',$current_user->id,'parent_id') == '0') { array_push($header,$mod_strings['LBL_RELATEDTO']); array_push($header_width,'15%'); } if(getFieldVisibilityPermission('Calendar',$current_user->id,'contact_id') == '0') { array_push($header,$mod_strings['LBL_CONTACT_NAME']); array_push($header_width,'15%'); }*/ if (getFieldVisibilityPermission('Calendar', $current_user->id, 'taskstatus') == '0') { array_push($header, $mod_strings['LBL_STATUS']); array_push($header_width, '10%'); } if (isPermitted("Calendar", "EditView") == "yes" || isPermitted("Calendar", "Delete") == "yes") { array_push($header, $mod_strings['LBL_ACTION']); } array_push($header, $mod_strings['LBL_ASSINGEDTO']); array_push($header_width, '15%'); } if ($current_user->column_fields['is_admin'] == 'on') { $Res = $adb->pquery("select * from vtiger_activitytype", array()); } else { $roleid = $current_user->roleid; $subrole = getRoleSubordinates($roleid); if (count($subrole) > 0) { $roleids = $subrole; array_push($roleids, $roleid); } else { $roleids = $roleid; } if (count($roleids) > 1) { $Res = $adb->pquery("select distinct activitytype from vtiger_activitytype inner join vtiger_role2picklist on vtiger_role2picklist.picklistvalueid = vtiger_activitytype.picklist_valueid where roleid in (" . generateQuestionMarks($roleids) . ") and picklistid in (select picklistid from vtiger_activitytype) order by sortid asc", array($roleids)); } else { $Res = $adb->pquery("select distinct activitytype from vtiger_activitytype inner join vtiger_role2picklist on vtiger_role2picklist.picklistvalueid = vtiger_activitytype.picklist_valueid where roleid = ? and picklistid in (select picklistid from vtiger_activitytype) order by sortid asc", array($roleid)); } } $eventlist = ''; for ($i = 0; $i < $adb->num_rows($Res); $i++) { $eventlist .= $adb->query_result($Res, $i, 'activitytype') . ";"; } $list_view .= "<table align='center' border='0' cellpadding='5' cellspacing='0' width='98%'>\n\t\t\t<tr><td colspan='3'> </td></tr>"; //checking permission for Create/Edit Operation if (isPermitted("Calendar", "EditView") == "yes") { $list_view .= "<tr>\n\t\t\t\t<td class='calAddButton' onMouseOver='fnAddEvent(this,\"addEventDropDown\",\"" . $temp_date . "\",\"" . $endtemp_date . "\",\"" . $time_arr['starthour'] . "\",\"" . $time_arr['startmin'] . "\",\"" . $time_arr['startfmt'] . "\",\"" . $time_arr['endhour'] . "\",\"" . $time_arr['endmin'] . "\",\"" . $time_arr['endfmt'] . "\",\"\",\"" . $subtab . "\",\"" . $eventlist . "\");'style='border: 1px solid #666666;cursor:pointer;height:30px' align='center' width='10%'>\n " . $mod_strings['LBL_ADD'] . "\n <img src='" . vtiger_imageurl('menuDnArrow.gif', $theme) . "' style='padding-left: 5px;' border='0'> </td>"; } else { $list_view .= "<tr><td> </td>"; } $list_view .= "<td align='center' width='60%'><span id='total_activities'>" . getTodoInfo($cal, 'listcnt') . "</span> </td>\n\t\t\t\t<td align='right' width='28%'> </td>\n\t\t\t</tr>\n\t\t</table>\n\n\t\t\t<br><table style='background-color: rgb(204, 204, 204);' class='small' align='center' border='0' cellpadding='5' cellspacing='1' width='98%'>\n "; $header_rows = count($header); $navigationOutput = getTableHeaderNavigation($navigation_array, $url_string, "Calendar", "index"); if ($navigationOutput != '') { $list_view .= "<tr width=100% bgcolor=white><td align=center colspan={$header_rows}>"; $list_view .= "<table align=center width='98%'><tr>" . $navigationOutput . "</tr></table></td></tr>"; } $list_view .= "<tr>"; for ($i = 0; $i < $header_rows; $i++) { $list_view .= "<td class='lvtCol' width='" . $header_width[$i] . "' nowrap='nowrap'>" . $header[$i] . "</td>"; } $list_view .= "</tr>"; $rows = count($todo_list); if ($rows != 0) { for ($i = 0; $i < count($todo_list); $i++) { $list_view .= "<tr style='height: 25px;' bgcolor='white'>"; foreach ($todo_list[$i] as $key => $entry) { $list_view .= "<td>" . $entry . "</td>"; } $list_view .= "</tr>"; } } else { $list_view .= "<tr><td style='background-color:#efefef;height:340px' align='center' colspan='" . $colspan . "'>"; $list_view .= "<div style='border: 3px solid rgb(153, 153, 153); background-color: rgb(255, 255, 255); width: 45%; position: relative; z-index: 5000;'>\n\t\t\t<table border='0' cellpadding='5' cellspacing='0' width='98%'>\n\t\t\t<tr>\n\t\t\t\t<td rowspan='2' width='25%'>\n\t\t\t\t\t<img src='" . vtiger_imageurl('empty.jpg', $theme) . "' height='60' width='61'></td>\n\t\t\t\t<td style='border-bottom: 1px solid rgb(204, 204, 204);' nowrap='nowrap' width='75%'><span class='genHeaderSmall'>" . $app_strings['LBL_NO'] . " " . $app_strings['Todos'] . " " . $app_strings['LBL_FOUND'] . " !</span></td>\n\t\t\t</tr>\n\t\t\t<tr>"; //checking permission for Create/Edit Operation if (isPermitted("Calendar", "EditView") == "yes") { $list_view .= "<td class='small' align='left' nowrap='nowrap'>" . $app_strings['LBL_YOU_CAN_CREATE'] . " " . $app_strings['LBL_A'] . " " . $app_strings['Todo'] . " " . $app_strings['LBL_NOW'] . ". " . $app_strings['LBL_CLICK_THE_LINK'] . " :<br>\n\t\t\t\t\t -<a href='javascript:void(0);' onClick='gshow(\"createTodo\",\"todo\",\"" . $temp_date . "\",\"" . $temp_date . "\",\"" . $time_arr['starthour'] . "\",\"" . $time_arr['startmin'] . "\",\"" . $time_arr['startfmt'] . "\",\"" . $time_arr['endhour'] . "\",\"" . $time_arr['endmin'] . "\",\"" . $time_arr['endfmt'] . "\",\"listview\",\"todo\");'>" . $app_strings['LBL_CREATE'] . " " . $app_strings['LBL_A'] . " " . $app_strings['Todo'] . "</a>\n\t\t\t\t\t</td>"; } else { $list_view .= "<td class='small' align='left' nowrap='nowrap'>" . $app_strings['LBL_YOU_ARE_NOT_ALLOWED_TO_CREATE'] . " " . $app_strings['LBL_A'] . " " . $app_strings['Todo'] . "<br></td>"; } $list_view .= "</tr>\n\t\t\t</table>\n\t\t\t</div>"; $list_view .= "</td></tr>"; } $list_view .= "</table><br>"; $cal_log->debug("Exiting constructTodoListView() method..."); return $list_view; }
} } } //check if there is at least one fully public election left if (count($fully_public) > 0) { $public_elections_displayed = "<table id='table_1' class='table table-striped table-bordered' cellspacing='0'>\n <thead class='success'>\n <tr>\n <th>Name</th>\n <th>Start Date</th>\n <th>Start Time</th>\n <th>End Date</th>\n <th>End Time</th>\n <th>Pin</th>\n <th></th>\n </tr>\n </thead><tbody>"; $public_index = array('election_name', 'election_start_date', 'election_time_from', 'election_end_date', 'election_time_to', 'election_pin'); $public_index_number = count($public_index); for ($move = 0; $move < count($fully_public); $move++) { $public_elections_displayed .= "<tr>"; for ($index = 0; $index < $public_index_number; $index++) { if (count(explode("_", $public_index[$index])) === 3) { if (explode("_", $public_index[$index])[2] === 'date') { $public_elections_displayed .= "<td>" . dateString($fully_public[$move][$public_index[$index]]) . "</td>"; } elseif (explode("_", $public_index[$index])[1] === 'time') { $public_elections_displayed .= "<td>" . timeString($fully_public[$move][$public_index[$index]]) . "</td>"; } } else { $public_elections_displayed .= "<td >" . $fully_public[$move][$public_index[$index]] . "</td>"; } } $key = wrap($fully_public[$move]['election_id']); $public_elections_displayed .= "<td><span class='button btn-default btn-sm pop2' data-bpopup='{\"content\":\"iframe\",\"contentContainer\":\".content\",\"loadUrl\":\"publicElections.php?key=" . $key . "\"}'>View</span></td>"; // $public_elections_displayed.="<td><a href='#' onclick='Public($key)'>See </a></td>"; $public_elections_displayed .= "</tr>"; } $public_elections_displayed .= "</tbody></table>"; $public_adek = true; } ?>
</td> </tr> <tr> <td><a href="#" class="info"><?php echo _("Ring Time:"); ?> <span><?php echo _("The number of seconds an phone can ring before we consider it a timeout. Max 60 Seconds."); ?> </span></a></td> <td> <select name="grptime"/> <?php $default = $grptime ? $grptime : 20; for ($i = 1; $i <= 60; $i++) { echo '<option value="' . $i . '" ' . ($i == $default ? 'SELECTED' : '') . '>' . timeString($i, true) . '</option>'; } ?> </select> </td> </tr> <tr><td colspan="2"><br><h5><?php echo _("Destination if no answer"); ?> </h5></td></tr> <?php $goto = getargs(ltrim($extdisplay, 'GRP-'), 2, 'ext-group'); ?> <tr><td colspan="2">
} function calcularRitmo($distancia, $tiempo) { $ritmo = []; for ($i = 0; $i < count($tiempo); $i++) { $ritmo[] = floor($tiempo[$i] / $distancia); if ($i + 1 < count($tiempo)) { $tiempo[$i + 1] += $tiempo[$i] % $distancia * 60; } } return $ritmo; } function timeString($vectorTiempo) { $vectorCadenas = []; foreach ($vectorTiempo as $valor) { if ($valor < 10) { $vectorCadenas[] = "0" . strval($valor); } else { $vectorCadenas[] = strval($valor); } } return "{$vectorCadenas['0']}:{$vectorCadenas['1']}:{$vectorCadenas['2']}"; } $distancia = floatval($_POST['distancia']) / 1000; $tiempo = parseTiempo($_POST['tiempo']); $ritmo = calcularRitmo($distancia, $tiempo); echo "Distancia total de {$distancia} Km"; echo "<br />"; echo "Ritmo: " . timeString($ritmo) . " por Km.";