public function find($id, Application_Model_BenchmarkCharts $chart) { $result = $this->getDbTable()->find($id); if (0 == count($result)) { return; } $row = $result->current(); $chart->setId($row->id)->setCid($row->cid)->setName($row->name) - setDate($row->modified); }
<?php include "includes/header.php"; include "functions.php"; ?> <div class="sidebar1"> <ul class="nav"> <div align="center"> <p> </p> <?php setDate(); ?> </div> <div align="center"> <li><a href="index_admin.php"><img src="images/immnu_01a.gif" width="140" height="25" onMouseOver="javascript: this.src='images/immnu_01b.gif';" onMouseOut="javascript: this.src='images/immnu_01a.gif';"/></a></li> <li><a href="musik_admin.php"><img src="images/immnu_02a.gif" width="140" height="25" onMouseOver="javascript: this.src='images/immnu_02b.gif';" onMouseOut="javascript: this.src='images/immnu_02a.gif';"/></a></li> <li><a href="profil_admin.php"><img src="images/immnu_03a.gif" width="140" height="25" onMouseOver="javascript: this.src='images/immnu_03b.gif';" onMouseOut="javascript: this.src='images/immnu_03a.gif';"/></a></li> <li><a href="upload_admin.php"><img src="images/immnu_04a.gif" width="140" height="25" onMouseOver="javascript: this.src='images/immnu_04b.gif';" onMouseOut="javascript: this.src='images/immnu_04a.gif';"/></a></li> <li><a href="kontakt_admin.php"><img src="images/immnu_05a.gif" width="140" height="25" onMouseOver="javascript: this.src='images/immnu_05b.gif';" onMouseOut="javascript: this.src='images/immnu_05a.gif';"/></a></li> <form action="search_admin.php" method="post"> <br> <input type="text" placeholder="Titel oder Interpret" name="search"input style='width: 120px;' > <input type="submit" name="submitSearch" value="Suche"> </form> </div> </ul> <?php
<th>Xử lý</th> </tr> </thead> <tbody> <?php $i = 1; foreach ($lists as $key => $value) : ?> <tr class="gradeX" data-id="<?php echo $value->storage_question_id; ?>"> <td><?php echo $i++; ?></td> <td> <a class="sq-ajax-modal" href="<?php echo site_url(BACKEND_V2_TMPL_PATH . 'storage-question/view/' . $value->storage_question_id); ?>"> <?php echo word_limiter(sanitizeText($value->question_name), 6); ?> </a> <td><?php echo $value->title; ?></td> <td><?php echo setDate($value->updated_time, 'time'); ?></td> <td class="actions"> <a href="#" class="on-default edit-row"><i class="fa fa-pencil"></i></a> <a href="#" class="on-default remove-row"><i class="fa fa-trash-o"></i></a> </td> </tr> <?php endforeach; ?> </tbody> </table> </div> </section> <?php echo $this->load->view(BACKEND_V2_TMPL_PATH . 'dialogs/dialog_delete', null, true); ?> <!-- Specific Page Vendor --> <script src="<?php echo BACKEND_V2_VENDOR_PATH; ?>jquery-datatables/media/js/jquery.dataTables.js"></script> <script src="<?php echo BACKEND_V2_VENDOR_PATH; ?>jquery-datatables-bs3/assets/js/datatables.js"></script> <script src="<?php echo BACKEND_V2_VENDOR_PATH; ?>magnific-popup/magnific-popup.js"></script>
$srtDate = strtotime($date); $dateOk = date_i18n('F d', $srtDate); return $dateOk; } ?> <ul class="activities"> <?php while ($acts->have_posts()) { $acts->the_post(); ?> <li> <div class="activities-date"> <span><?php echo setDate(get_field('date1')); ?> </span> </div> <div class="activities-title"><?php the_title(); ?> </div> </li><?php } ?> </ul> <?php } wp_reset_query();
function setDate($date, $datestring, $format = 'ISO') { if (preg_match('/^(\\d{4})-?(\\d{2})-?(\\d{2})([T\\s]?(\\d{2}):?(\\d{2}):?(\\d{2})(Z|[\\+\\-]\\d{2}:?\\d{2})?)?$/i', $date, $regs) && $format != 'UNIX') { // DATE_FORMAT_ISO, ISO_BASIC, ISO_EXTENDED, and TIMESTAMP // These formats are extremely close to each other. This regex // is very loose and accepts almost any butchered format you could // throw at it. e.g. 2003-10-07 19:45:15 and 2003-10071945:15 // are the same thing in the eyes of this regex, even though the // latter is not a valid ISO 8601 date. $year = $regs[1]; $month = $regs[2]; $day = $regs[3]; $thour = isset($regs[5]) ? $regs[5] : 0; $minute = isset($regs[6]) ? $regs[6] : 0; $second = isset($regs[7]) ? $regs[7] : 0; return mdate($datestring, mktime(0, 0, 0, $month, $day, $year)); } elseif (is_numeric($date)) { // UNIXTIME setDate(date("Y-m-d H:i:s", $date)); } else { // unknown format $year = 0; $month = 1; $day = 1; $hour = 0; $minute = 0; $second = 0; return mdate($datestring, mktime(0, 0, 0, $month, $day, $year)); } }
$checked = $value->review == 'SHOW' ? 'checked="checked"' : ''; ?> <div class="switch switch-sm switch-primary"> <input data-id="<?php echo $value->topic_manage_id; ?>" type="checkbox" data-review="<?php echo $change_to; ?>" name="switch" data-plugin-ios-switch <?php echo $checked; ?> /> </div> </td> <td style="text-align: center"> <?php echo anchor(BACKEND_V2_TMPL_PATH . 'topic/export/' . $id, "<img src=\"" . BACKEND_V2_IMAGE_PATH . "rar.png\" />"); ?> </td> <td style="text-align: center"> <a href="javascript:void(0);" class="showListStudentAnswer" id="<?php echo $value->topic_manage_id; ?>"> <img src="<?php echo BACKEND_V2_IMAGE_PATH; ?>rar.png" /> </a> </td> <td><?php echo setDate($value->created_time, 'notime'); ?></td> <td class="actions"> <a href="#" class="on-default edit-row"><i class="fa fa-pencil"></i></a> <a href="#" class="on-default remove-row"><i class="fa fa-trash-o"></i></a> </td> </tr> <?php endforeach; ?> </tbody> </table> </div> </section> <?php echo $this->load->view(BACKEND_V2_TMPL_PATH . 'dialogs/dialog_delete', null, true); ?> <?php echo $this->load->view(BACKEND_V2_TMPL_PATH . 'topic/modal', null, true); ?> <!-- Specific Page Vendor --> <script src="<?php echo BACKEND_V2_VENDOR_PATH; ?>jquery-datatables/media/js/jquery.dataTables.js"></script> <script src="<?php echo BACKEND_V2_VENDOR_PATH; ?>jquery-datatables-bs3/assets/js/datatables.js"></script>
function setTable($table) { global $time; $newtable = array(); $table1Arr = array(); $time = setDate($time); $date = new DateTime($time); foreach ($table as $tb) { $value = filter($tb->nodeValue); array_push($table1Arr, $value); } for ($i = 0; $i < sizeof($table1Arr); $i++) { $str = str_replace(' ', '', trim($table1Arr[$i])); preg_match('/[0-9]:[0-9]/', $str, $treffer); if (sizeof($treffer) == 1) { $exp = explode(':', $treffer[0]); $table1Arr[$i - 1] = trim($table1Arr[$i - 1]); $table1Arr[$i + 1] = trim($table1Arr[$i + 1]); if ($exp[0] > $exp[1]) { array_push($newtable, array('date' => setDate($table1Arr[$i - 2]), 'team1' => $table1Arr[$i - 1], 'team2' => $table1Arr[$i + 1], 'winner' => $table1Arr[$i - 1], 'goals' => $treffer[0])); } else { if ($exp[0] < $exp[1]) { array_push($newtable, array('date' => setDate($table1Arr[$i - 2]), 'team1' => $table1Arr[$i - 1], 'team2' => $table1Arr[$i + 1], 'winner' => $table1Arr[$i + 1], 'goals' => $treffer[0])); } else { if ($exp[0] == $exp[1]) { array_push($newtable, array('date' => setDate($table1Arr[$i - 2]), 'team1' => $table1Arr[$i - 1], 'team2' => $table1Arr[$i + 1], 'winner' => 'no winner', 'goals' => $treffer[0])); } } } } } return $newtable; }
public function export($id) { $tid = intval(substr($id, strpos($id, 'tid') + 3, strlen($id))); $topic_manage = $this->topic_manage_model->findById($tid); $topic_manage['created_time'] = setDate($topic_manage['created_time'], 'notime'); // create folder name ob_start(); $this->load->library('stringobj'); $title = $this->stringobj->createAlias(implode('_', $topic_manage), '_'); if (!file_exists(BACKEND_V2_DOC_PATH_DIR . $title)) { mkdir(BACKEND_V2_DOC_PATH_DIR . $title); } // danh sach đề thi $topics = $this->topic_model->getTopicByTopicManageId($tid); // gen msdoc $array_topic = $this->word->exportTopic($topics, $title); // zip folder $this->load->library('recursezip'); $src = BACKEND_V2_DOC_PATH_DIR . $title; // Destination folder where we create Zip file. $dst = BACKEND_V2_DOC_PATH_DIR; $zip = $this->recursezip->compress($src, $dst); // delete doc file foreach ($array_topic as $topic) { @unlink($topic); } // delete folder @rmdir($src); // Download zip file. my_force_download($title . '.zip', $zip); flush(); // delete zip file @unlink($zip); flush(); }
/** * Run the database seeds. * * @return void */ public function run() { $this->command->info('Seeding: CreateProfilesProjectsSeeder Class...'); //converting string to date; function setDate() { $min_date = '2014-09-01 00:00:00'; $max_date = '2014-10-31 00:00:00'; $min_epoch = strtotime($min_date); $max_epoch = strtotime($max_date); $rand_epoch = rand($min_epoch, $max_epoch); return date('Y-m-d H:i:s', $rand_epoch); } function getToday($date) { return $date->format('YmdHis'); } // create a dummy image for project function getProjectsThumbnail() { $thumbnail = ['image-1.jpg', 'image-2.jpg', 'image-3.jpg', 'image-5.jpg', 'image-6.jpg', 'image-7.jpg', 'image-8.jpg', 'image-9.jpg']; return $thumbnail[array_rand($thumbnail)]; } //set variable for faker class $faker = Faker\Factory::create(); // clean the data first DB::table('projects')->delete(); DB::table('user_profiles')->delete(); // delete all images folder $directory = public_path() . '/uploads/projects'; File::deleteDirectory($directory, true); // set required limit for users $user_limit = 5; // loop for require number of users for ($i = 0; $i < $user_limit; $i++) { $first_name = $faker->firstName($gender = null | 'male' | 'female'); $last_name = $faker->lastName; $username = strtolower($first_name) . '.' . strtolower($last_name); $email = $username . '@gmail.com'; // create sentry user Sentry::getUserProvider()->create(array('email' => $email, 'username' => $username, 'password' => 'sentrytest', 'activated' => 1)); // set default user property rights $userUser = Sentry::getUserProvider()->findByLogin($email); $userGroup = Sentry::getGroupProvider()->findByName('Users'); $userUser->addGroup($userGroup); // get the user id for foreign key $user_id = $userUser['attributes']['id']; // prepare data for profiles table $user_profiles = ['user_id' => $user_id, 'first_name' => $first_name, 'last_name' => $last_name, 'contact_number' => $faker->numerify($string = '############'), 'company' => $faker->company . ' ' . $faker->companySuffix, 'created_at' => new DateTime(), 'updated_at' => new DateTime()]; // insert the data in user profiles DB::table('user_profiles')->insert($user_profiles); // dummy thumbnail setup /*-------------------------------------------------------*/ $projects = public_path() . '/uploads/projects'; $dummyDir = public_path() . '/assets/images/dummy/projects'; // set random limit of projects per user_id $random_limit = rand(7, 9); $this->command->info('->current number of user (' . $i . '/ ' . $user_limit . ' )'); // set the random limit of projects per user for ($a = 0; $a < $random_limit; $a++) { $this->command->info('-->random number of projects per user id (' . $a . '/ ' . $random_limit . ' )'); // create folder based on username $usernameDir = $projects; File::makeDirectory($usernameDir, 0777, true, true); /*-------------------------------------------------------*/ $date = getToday(new DateTime()); $thumbnail = getProjectsThumbnail(); $link = URL::asset('uploads/projects') . '/' . $date . '/' . $thumbnail; // prepare data for projects table $project = ['title' => $faker->text($maxNbChars = 25), 'short_description' => $faker->text($maxNbChars = 200), 'thumbnail' => $link, 'target_fund' => $faker->numberBetween($min = 500, $max = 3000), 'thumbnail' => $link, 'target_date' => setDate(), 'activated' => rand(0, 1), 'user_id' => $user_id, 'created_at' => new DateTime(), 'updated_at' => new DateTime()]; // insert the data in user profiles DB::table('projects')->insert($project); // create directory folder uploads/username/date $newDirectory = $usernameDir . '/' . $date; File::makeDirectory($newDirectory, 0777, true, true); // create a dummy thumbnail for the project $oldFile = $dummyDir . '/' . $thumbnail; $newFile = $newDirectory . '/' . $thumbnail; File::copy($oldFile, $newFile); } } }
$srtDate = strtotime($date); $dateOk = date_i18n('l, F d', $srtDate); return $dateOk; } $loop = new WP_Query(array('post_type' => $postType, 'posts_per_page' => -1, 'meta_query' => array(array('key' => 'date2')), 'orderby' => 'meta_value_num', 'order' => 'ASC')); if ($loop->have_posts()) { ?> <div class='the-content'> <ul class='events-list'> <?php while ($loop->have_posts()) { $loop->the_post(); $dateOk1 = setDate(get_field('date1')); $dateOk2 = setDate(get_field('date2')); ?> <li> <span class='date'> <?php echo $dateOk1; if (get_field('displayTime1')) { echo ' (' . get_field('time1'); if (get_field('displayTime2') && $dateOk1 == $dateOk2) { echo ' to ' . get_field('time2'); } echo ')'; } if ($dateOk1 != $dateOk2) { echo ' to ' . $dateOk2;