function fetch_action_listing($action) { $string = "<span style='margin-left:20px;cursor:pointer;"; $string = has_action_been_worked_on($action->id) ? $string . "color:grey;text-decoration:line-through;' \n title='Cancel work' \n onmouseover=\"\$(this).css('text-decoration', 'none');\" \n onmouseleave=\"\$(this).css('text-decoration', 'line-through');\"\n onclick=\"cancelWork({$action->id});\"" : $string . "' title='Click to indicate action worked.' \n onmouseover=\"\$(this).css('text-decoration', 'line-through');\" \n onmouseleave=\"\$(this).css('text-decoration', 'none');\" \n onclick=\"createWork({$action->id});\""; $string = $string . "> {$action->name} [" . convert_work_num_to_caption($action->work) . "]</span>"; if ($action->type == 1) { $string = $string . "<input id='action_quantity_{$action->id}' type='number' value='{$action->default_quantity}'/>"; } return $string; }
<?php require_once "config.php"; require_once "work.php"; $connection = new PDO("mysql:host=" . DB_HOST . ";dbname=" . DB_NAME, DB_USER, DB_PWD); $statement = $connection->query("select * from achievements where deleted=0 and quality=false and work>0 order by rank asc"); $statement->execute(); while ($achievement = $statement->fetchObject()) { if (!has_achievement_been_worked_on($achievement->id) && is_it_the_appropriate_day($achievement->work)) { echo " <div>\n <div style='font-weight:bold;'>\n <a href='" . SITE_ROOT . "/?rla={$achievement->id}'>\n {$achievement->name} [" . convert_work_num_to_caption($achievement->work) . "]\n </a>\n </div>"; $action_statement = $connection->query("select * from actions where active=1 and achievement_id={$achievement->id}"); $action_statement->execute(); while ($action = $action_statement->fetchObject()) { echo " <div style='margin-left:16px;'>" . fetch_action_listing($action) . "</div>"; } echo " </div>"; } } $statement = $connection->query("select * from achievements where deleted=0 and quality=false and work>0 order by rank asc"); $statement->execute(); while ($achievement = $statement->fetchObject()) { if (has_achievement_been_worked_on($achievement->id) && is_it_the_appropriate_day($achievement->work)) { echo " <div>\n <div style='font-weight:bold;text-decoration:line-through;'>\n <a href='" . SITE_ROOT . "/?rla={$achievement->id}'>\n {$achievement->name} [" . convert_work_num_to_caption($achievement->work) . "]\n </a>\n </div>"; } }
require_once "../php/achievements.php"; $connection = new PDO("mysql:host=" . DB_HOST . ";dbname=" . DB_NAME, DB_USER, DB_PWD); $today = 0; $last_time = 0; if (!has_work_been_checked()) { check_work(); } $statement = $connection->query("select * from work where action_id!=0 and active=1 order by created desc"); $statement->execute(); while ($work = $statement->fetchObject()) { $action = fetch_action($work->action_id); $achievement = fetch_achievement($action->achievement_id); if ($today != date("m/d/y", strtotime($work->created))) { echo "<h2>" . date("m/d/y l", strtotime($work->created)) . "</h2>"; $today = date("m/d/y", strtotime($work->created)); } if ($last_time != date("H:i", strtotime($work->created))) { echo "<div style='margin-top:24px'>" . date("H:i", strtotime($work->created)) . "</div>"; $last_time = date("H:i", strtotime($work->created)); } echo "<div style='margin-top:8px'>"; if (!strtotime($work->updated) && $work->worked) { echo " <input style='margin-right:8px;' type='button' value='X' onclick=\"cancelWork({$action->id});\" />"; } echo $work->worked ? "Finished " : "<span style='color:red;'>Incompleted </span> "; echo strtolower(convert_work_num_to_caption($work->work)) . " work on \"{$action->name}\""; if (strtotime($work->updated)) { echo " then cancelled at " . date("H:i:s", strtotime($work->created)) . " </span>"; } echo "</div>"; }