public function writeProgram(Work $w) { if ($w->hour < 13) { echo sprintf('当前时间:%s 点 饿了,午饭;犯困,午休。%s', $w->hour, PHP_EOL); } else { $w->setState(new AfternoonState()); $w->writeProgram(); } }
public function writeProgram(Work $w) { if ($w->hour < 12) { echo sprintf('当前时间:%s 点 上午工作,精神百倍%s', $w->hour, PHP_EOL); } else { $w->setState(new NoonState()); $w->writeProgram(); } }
public function writeProgram(Work $w) { if ($w->hour < 17) { echo sprintf('当前时间:%s 点 下午状态还不错,继续努力%s', $w->hour, PHP_EOL); } else { echo $w->setState(new EveningState()); $w->writeProgram(); } }
public function writeProgram(Work $w) { if ($w->finish) { $w->setState(new RestState()); $w->writeProgram(); } else { if ($w->hour < 21) { echo sprintf('当前时间:%s 点 加班哦,疲惫至极%s', $w->hour, PHP_EOL); } else { $w->setState(new SleepingState()); $w->writeProgram(); } } }
public function showUser($screen_name) { if (User::where('screen_name', '=', $screen_name)->first() == NULL) { return Response::view('404', array('title' => '404 page'), 404); } $category_names = array('ent' => 'エンターテイメント', 'music' => '音楽', 'sing' => '歌ってみた', 'play' => '演奏してみた', 'dance' => '踊ってみた', 'vocaloid' => 'VOCALOID', 'nicoindies' => 'ニコニコインディーズ', 'animal' => '動物', 'cooking' => '料理', 'nature' => '自然', 'travel' => '旅行', 'sport' => 'スポーツ', 'lecture' => 'ニコニコ動画講座', 'drive' => '車載動画', 'history' => '歴史', 'politics' => '政治', 'science' => '科学', 'tech' => 'ニコニコ技術部', 'handcraft' => 'ニコニコ手芸部', 'make' => '作ってみた', 'anime' => 'アニメ', 'game' => 'ゲーム', 'toho' => '東方', 'imas' => 'アイドルマスター', 'radio' => 'ラジオ', 'draw' => '描いてみた', 'are' => '例のアレ', 'diary' => '日記', 'other' => 'その他', 'r18' => 'R-18', 'original' => 'オリジナル', 'portrait' => '似顔絵', 'character' => 'キャラクター'); $user = User::where('screen_name', '=', $screen_name)->first(); $star_items = $this->getStars($screen_name); try { $items = Item::where('user_id', '=', $user->id)->orderby('created_at', 'desc')->take(10)->get(); foreach ($items as &$item) { $item['user'] = User::where('id', '=', $item->user_id)->get()[0]; $item['star_count'] = Starmap::where('item_id', '=', $item->id)->count(); $item['comment_count'] = Comment::where('item_id', '=', $item->id)->count(); if ($item->category_id != 0) { $item['category'] = Category::where('id', '=', $item->category_id)->get()[0]->content; } } $works = Work::where('user_id', '=', $user->id)->orderby('created_at', 'desc')->take(10)->get(); foreach ($works as &$work) { $item = Item::where('id', '=', $work->item_id)->get()[0]; $work['item'] = $item; $work['user'] = User::where('id', '=', $work->user_id)->get()[0]; $work['item']['user'] = User::where('id', '=', $work->item->user_id)->get()[0]; if ($item->category_id) { $work['item_category'] = Category::where('id', '=', $item->category_id)->get()[0]->content; } } $twitter_profile = array('user' => $user, 'items' => $items, 'title' => $screen_name, 'stars' => $star_items, 'works' => $works, 'categories' => $category_names, 'star_count' => Starmap::where('user_id', '=', $user->id)->count(), 'work_count' => Work::where('user_id', '=', $user->id)->count()); return View::make('user', $twitter_profile); } catch (Exception $e) { echo $e->getMessage(); } }
public function work($id) { if (!($id && ($work = Work::find('one', array('conditions' => array('id = ? AND is_enabled = ? AND destroy_user_id IS NULL', $id, Work::ENABLE_YES)))))) { return array(); } if ($work->tags) { usort($work->tags, function ($a, $b) { return count($a->mappings) < count($b->mappings); }); } if ($work->tags && ($work_ids = column_array(WorkTagMapping::find('all', array('select' => 'work_id', 'order' => 'RAND()', 'limit' => 5, 'conditions' => array('work_id != ? AND work_tag_id = ?', $work->id, $work->tags[0]->id))), 'work_id'))) { Work::addConditions($conditions, 'id IN (?)', $work_ids); } else { Work::addConditions($conditions, 'id != ?', $work->id); } Work::addConditions($conditions, 'is_enabled = ? AND destroy_user_id IS NULL', Work::ENABLE_YES); $others = Work::find('all', array('select' => 'id, title', 'limit' => 5, 'conditions' => $conditions)); return array('work' => array_merge($work->to_array(array('only' => array('id', 'title', 'content', 'pv'), 'methods' => array('site_show_page_last_uri'))), array('mini_content' => array('150' => $work->mini_content(150), '300' => $work->mini_content(300)), 'cover_url' => array('1200x630c' => $work->cover->url('1200x630c')), 'updated_at' => array('c' => $work->updated_at->format('c'), 'Y-m-d H:i:s' => $work->updated_at->format('Y-m-d H:i:s')), 'created_at' => array('c' => $work->created_at->format('c'), 'Y-m-d H:i:s' => $work->created_at->format('Y-m-d H:i:s')))), 'tags' => array_map(function ($tag) { return $tag->to_array(array('only' => array('id', 'name'))); }, $work->tags), 'others' => array_map(function ($work) { return $work->to_array(array('only' => array(), 'methods' => array('site_show_page_last_uri'))); }, $others), 'blocks' => array_map(function ($block) { return array('title' => $block->title, 'items' => array_map(function ($item) { return $item->to_array(array('only' => array('link', 'title'))); }, $block->items)); }, WorkBlock::find('all', array('include' => array('items'), 'conditions' => array('work_id = ?', $work->id)))), 'pictures' => array_map(function ($picture) { return array('name' => array('800w' => $picture->name->url('800w'))); }, $work->pictures)); }
public function index($tag_id, $offset = 0) { $columns = array(); $configs = array('work-tag', $this->tag->id, 'works', '%s'); $conditions = conditions($columns, $configs); WorkTagMapping::addConditions($conditions, 'work_tag_id = ?', $this->tag->id); $limit = 12; $total = WorkTagMapping::count(array('conditions' => $conditions)); $offset = $offset < $total ? $offset : 0; $this->load->library('pagination'); $pagination = $this->pagination->initialize(array_merge(array('total_rows' => $total, 'num_links' => 3, 'per_page' => $limit, 'uri_segment' => 0, 'base_url' => '', 'page_query_string' => false, 'first_link' => '第一頁', 'last_link' => '最後頁', 'prev_link' => '上一頁', 'next_link' => '下一頁', 'full_tag_open' => '<ul class="pagination">', 'full_tag_close' => '</ul>', 'first_tag_open' => '<li class="f">', 'first_tag_close' => '</li>', 'prev_tag_open' => '<li class="p">', 'prev_tag_close' => '</li>', 'num_tag_open' => '<li>', 'num_tag_close' => '</li>', 'cur_tag_open' => '<li class="active"><a href="#">', 'cur_tag_close' => '</a></li>', 'next_tag_open' => '<li class="n">', 'next_tag_close' => '</li>', 'last_tag_open' => '<li class="l">', 'last_tag_close' => '</li>'), $configs))->create_links(); $work_ids = column_array(WorkTagMapping::find('all', array('select' => 'work_id', 'offset' => $offset, 'limit' => $limit, 'order' => 'work_id DESC', 'conditions' => $conditions)), 'work_id'); $works = $work_ids ? Work::find('all', array('order' => 'FIELD(id,' . implode(',', $work_ids) . ')', 'conditions' => array('is_enabled = ? AND id IN (?) AND destroy_user_id IS NULL', Work::ENABLE_YES, $work_ids))) : array(); if ($works) { $this->add_meta(array('name' => 'keywords', 'content' => implode(',', column_array($works, 'title')) . ',' . implode(',', Cfg::setting('site', 'site', 'keywords'))))->add_meta(array('name' => 'description', 'content' => $works[0]->mini_content(150)))->add_meta(array('property' => 'og:title', 'content' => $this->tag->name . '作品' . ' - ' . Cfg::setting('site', 'site', 'title')))->add_meta(array('property' => 'og:description', 'content' => $works[0]->mini_content(300)))->add_meta(array('property' => 'og:image', 'tag' => 'larger', 'content' => $img = $works[0]->cover->url('1200x630c'), 'alt' => $this->tag->name . '作品' . ' - ' . Cfg::setting('site', 'site', 'title')))->add_meta(array('property' => 'og:image:type', 'tag' => 'larger', 'content' => 'image/' . pathinfo($img, PATHINFO_EXTENSION)))->add_meta(array('property' => 'og:image:width', 'tag' => 'larger', 'content' => '1200'))->add_meta(array('property' => 'og:image:height', 'tag' => 'larger', 'content' => '630'))->add_meta(array('property' => 'article:modified_time', 'content' => $works[0]->updated_at->format('c')))->add_meta(array('property' => 'article:published_time', 'content' => $works[0]->created_at->format('c'))); if (($tags = column_array($works[0]->tags, 'name')) || ($tags = Cfg::setting('site', 'site', 'keywords'))) { foreach ($tags as $i => $tag) { if (!$i) { $this->add_meta(array('property' => 'article:section', 'content' => $tag))->add_meta(array('property' => 'article:tag', 'content' => $tag)); } else { $this->add_meta(array('property' => 'article:tag', 'content' => $tag)); } } } } return $this->set_title($this->tag->name . '作品' . ' - ' . Cfg::setting('site', 'site', 'title'))->set_class('works')->set_method('index')->load_view(array('tag' => $this->tag, 'works' => $works, 'pagination' => $pagination, 'columns' => $columns)); }
public function showIndex() { if (!Auth::check()) { return View::make('login', array('title' => 'edison')); } $category_names = array('ent' => 'エンターテイメント', 'music' => '音楽', 'sing' => '歌ってみた', 'play' => '演奏してみた', 'dance' => '踊ってみた', 'vocaloid' => 'VOCALOID', 'nicoindies' => 'ニコニコインディーズ', 'animal' => '動物', 'cooking' => '料理', 'nature' => '自然', 'travel' => '旅行', 'sport' => 'スポーツ', 'lecture' => 'ニコニコ動画講座', 'drive' => '車載動画', 'history' => '歴史', 'politics' => '政治', 'science' => '科学', 'tech' => 'ニコニコ技術部', 'handcraft' => 'ニコニコ手芸部', 'make' => '作ってみた', 'anime' => 'アニメ', 'game' => 'ゲーム', 'toho' => '東方', 'imas' => 'アイドルマスター', 'radio' => 'ラジオ', 'draw' => '描いてみた', 'are' => '例のアレ', 'diary' => '日記', 'other' => 'その他', 'r18' => 'R-18', 'original' => 'オリジナル', 'portrait' => '似顔絵', 'character' => 'キャラクター'); $all_items = Item::orderBy('created_at', 'desc')->take(10)->get(); foreach ($all_items as &$item) { $item['user'] = User::where('id', '=', $item->user_id)->get()[0]; $item['star_count'] = Starmap::where('item_id', '=', $item->id)->count(); $item['comment_count'] = Comment::where('item_id', '=', $item->id)->count(); if ($item->category_id != 0) { $item['category'] = Category::where('id', '=', $item->category_id)->get()[0]->content; } } $recent_works = Work::orderBy('created_at', 'desc')->take(10)->get(); foreach ($recent_works as &$work) { $item = Item::where('id', '=', $work->item_id)->get()[0]; $work['item'] = $item; $work['user'] = User::where('id', '=', $work->user_id)->get()[0]; $work['item_poster_screen_name'] = User::where('id', '=', $item->user_id)->get()[0]->screen_name; if ($item->category_id != 0) { $work['item_category'] = Category::where('id', '=', $item->category_id)->get()[0]->content; } } $user = User::where('screen_name', '=', Auth::user()->screen_name)->get()[0]; $data = array('title' => 'edison', 'user' => $user, 'all_items' => $all_items, 'recent_works' => $recent_works, 'categories' => $category_names, 'star_count' => Starmap::where('user_id', '=', $user->id)->count(), 'work_count' => Work::where('user_id', '=', Auth::user()->id)->count()); return View::make('index', $data); }
public function sitmap() { $this->load->library('Sitemap'); // 基礎設定 $domain = 'http://www.zeusdesign.com.tw'; $sit_map = new Sitemap($domain); $sit_map->setPath(FCPATH . 'sitemap' . DIRECTORY_SEPARATOR); $sit_map->setDomain($domain); // main pages $sit_map->addItem('/', '0.5', 'weekly', date('c')); $sit_map->addItem('/abouts/', '0.5', 'weekly', date('c')); $sit_map->addItem('/contacts/', '0.5', 'weekly', date('c')); $sit_map->addItem('/works/', '0.8', 'daily', date('c')); $sit_map->addItem('/articles/', '0.8', 'daily', date('c')); // all articles foreach (Article::find('all', array('select' => 'id, title, updated_at', 'order' => 'id DESC', 'conditions' => array('is_visibled = ? AND destroy_user_id IS NULL', Article::IS_VISIBLED))) as $article) { $sit_map->addItem('/article/' . $article->site_show_page_last_uri(), '1', 'daily', $article->updated_at->format('c')); } // all article tags foreach (ArticleTag::all(array('select' => 'id')) as $tag) { $sit_map->addItem('/article-tag/' . $tag->id . '/articles/', '0.8', 'daily', date('c')); } // all works foreach (Work::find('all', array('select' => 'id, title, updated_at', 'order' => 'id DESC', 'conditions' => array('is_enabled = ? AND destroy_user_id IS NULL', Work::ENABLE_YES))) as $work) { $sit_map->addItem('/work/' . $work->site_show_page_last_uri(), '1', 'daily', $work->updated_at->format('c')); } // all work tags foreach (WorkTag::all(array('select' => 'id')) as $tag) { $sit_map->addItem('/work-tag/' . $tag->id . '/works/', '0.8', 'daily', date('c')); } $sit_map->createSitemapIndex($domain . '/sitemap/', date('c')); }
public function index() { $advice = \SecurityTip::orderBy(DB::raw("RAND()"))->first(); $news = \News::orderBy(DB::raw("RAND()"))->first(); $work = \Work::orderBy(DB::raw("RAND()"))->first(); return View::make('welcome/index', compact('news', 'work', 'advice')); }
public function run() { $file = file_get_contents('/var/www/lib.phpjim.ru/vendor/phpjim/parse-ficbook/test.html'); $work = new Work('/var/www/lib.phpjim.ru/vendor/phpjim/parse-ficbook/test.html'); //$work = new Work('http://ficbook.net/readfic/1003915'); $work->getData(); //$dom = new \DOMDocument(); // $dom->loadHTML($file); //$divs = array(); //foreach($dom->getElementsByTagName('div') as $div){ /** * @var $div \DOMElement */ //$class = explode(" ", $div->getAttribute('class')); // } return "Hello!"; }
public function editStoreWorkEdit($id) { $work = Work::find($id); $work->name = Input::get('name'); $work->workgroup_id = Input::get('workgroup_id'); $work->save(); return Redirect::to('/admin/workedit')->withErrors(['msg' => ['Работа ' . $work->id . ' change!']]); }
public function run() { $urls = array('sm21606267', 'sm22108018', 'sm22091259', 'sm22105280', 'sm22099716', 'im3518715', 'im3520973', 'im3520124'); $now = date('Y-m-d H:i:s'); $i = 0; foreach ($urls as $url) { Work::create(array('item_id' => mt_rand(1, 8), 'user_id' => mt_rand(1, 4), 'title' => 'タイトル', 'thumbnail_url' => 'http://tn-skr2.smilevideo.jp/smile?i=22130953', 'url' => $url, 'comment' => "{$url} の comment やで", 'created_at' => $now, 'updated_at' => $now)); } }
public function actionWork() { $criteria = new CDbCriteria(); $criteria->order = "id DESC"; $count = Work::model()->count($criteria); $pages = new CPagination($count); // элементов на страницу $pages->pageSize = 20; $pages->applyLimit($criteria); $work = Work::model()->findAll($criteria); $this->render('work', array('work' => $work, 'pages' => $pages)); }
public static function run() { self::$pool or self::$pool = new \SplQueue(); while (!self::$pool->isEmpty()) { $task = self::$pool->dequeue(); $task->run(); if ($task->complete()) { unset(self::$workers[$task->id()]); } else { self::$pool->enqueue($task); } } }
public function delete($work_id) { $work_user_id = Work::where('id', '=', $work_id)->get()[0]->user_id; // $work_item_id = Work::where('id', '=', $work_id)->get()[0]->item_id; // $item_user_id = Item::where('id', '=', $work_item_id)->get()[0]->user_id; // $item_user_screen_name = User::where('id', '=', $item_user_id)->get()[0]->screen_name; if (Auth::user()->id === $work_user_id) { Work::where('id', '=', $work_id)->delete(); return Redirect::to("/"); } else { return Redirect::to("/"); } }
public function getNoticeContents() { $login_user_id = Auth::user()->id; $notice = Starmap::where('user_id', '=', $login_user_id)->where('watched_flag', '=', 0)->where('notice_flag', '=', 1)->get(); $notice_item_ids = array(); foreach ($notice as $n) { $notice_item_ids[] = $n["item_id"]; } $notice_items_uesr = array(); $notice_item_titles = array(); $notice_work_ids = array(); foreach ($notice_item_ids as $notice_item_id) { $notice_items_uesr_ids[] = Item::where('id', '=', $notice_item_id)->get()[0]['user_id']; $notice_item_titles[] = Item::where('id', '=', $notice_item_id)->get()[0]['title']; $notice_work_ids[] = Work::where('item_id', '=', $notice_item_id)->orderBy('created_at', 'desc')->get()[0]['item_id']; } //$this->debug($notice_work_ids); $notice_work_user_ids = array(); $notice_work_title = array(); foreach ($notice_work_ids as $notice_work_id) { var_dump($notice_work_id); $notice_work_user_ids[] = Work::where('id', '=', $notice_work_id)->orderBy('updated_at', 'asc')->get()[0]['user_id']; $notice_work_title[] = Work::where('id', '=', $notice_work_id)->orderBy('id', 'asc')->get()[0]['title']; } $this->debug($notice_work_user_ids); //$this->debug($notice_work_title); // --------- $notice_work_user_screen_name = array(); foreach ($notice_work_user_ids as $notice_work_user_id) { $notice_work_user_screen_name = User::where('id', '=', $notice_work_user_id)->get()[0]['screen_name']; } //$this->debug($notice_work_user_screen_name); $notice_item_screen_name = array(); foreach ($notice_items_uesr_ids as $user_id) { $notice_item_screen_name[] = User::where('id', '=', $user_id)->get()[0]['screen_name']; } $json_val = array("notice_title" => $notice_item_titles, "notice_item_id" => $notice_item_ids, "notice_item_user" => $notice_item_screen_name, "notice_work_title" => $notice_work_title, "notice_work_user" => $notice_work_user_screen_name); header('Content-type: application/json'); echo json_encode($json_val); }
public function getEditFields($treeId, $moduleId) { $return = array(); $data = array(); $temp = array(); $sql = 'SELECT *, ' . $moduleId . ' AS module FROM {{data}} WHERE tree=' . $treeId . ' AND type NOT IN(\'' . implode('\',\'', Fields::$featuresField) . '\') ORDER BY num'; $additional = DB::getAll($sql); foreach ($additional as $item) { $temp[] = $item['path']; } $data = Work::getFields($moduleId); $sql = 'SELECT *, ' . $moduleId . ' AS module FROM {{catalog}} WHERE tree=' . $treeId . ''; $catalog = DB::getRow($sql); foreach ($data as $key => $item) { if (in_array($item['path'], OneSSA::$catalogStandart)) { $data[$key][Fields::$types[$item['type']]['type']] = $catalog[$item['path']]; } else { if (in_array($data[$key]['path'], $temp)) { unset($data[$key]); } } } $data = array_merge($data, $additional); if (Funcs::$prop['fieldsort'] == 0) { return $data; } else { $fields = Fields::getFieldsByModule($moduleId); foreach ($fields as $field) { foreach ($data as $item) { if ($field['path'] == $item['path']) { $return[] = $item; } } } return $return; } }
$app = new App("upper_case"); $app_version = new App_Version($app); $project->add_user($user); $project->add_app($app); $project->add_app_version($app_version); $project->start_feeder = true; $project->start_make_work = true; $project->start_validate = true; $project->start_file_delete = true; $project->start_assimilator = true; $project->install(); // must install projects before adding to hosts $host->log_flags = "log_flags.xml"; $host->add_user($user, $project); $host->install(); echo "adding work\n"; $work = new Work($app); $work->wu_template = "uc_wu"; $work->result_template = "uc_result"; $work->redundancy = 3; array_push($work->input_files, "input"); $work->install($project); $project->start_feeder(); $project->start_make_work($work); $project->start_validate($app, 3); $project->start_file_delete(); $project->start_assimilator($app); $project->start_stripchart(); //$project->start_servers(); $host->run(); $project->stop();
public function getEditFields($treeId, $moduleId) { $return = array(); $data = array(); $temp = array(); $sql = 'SELECT *, ' . $moduleId . ' AS module FROM {{data}} WHERE tree=' . $treeId . ' ORDER BY num'; $additional = DB::getAll($sql); foreach ($additional as $item) { $temp[] = $item['path']; } $data = Work::getFields($moduleId); $sql = 'SELECT * FROM {{fields}} WHERE module=' . $moduleId . ' AND innerf=1 ORDER BY num'; $fields = DB::getRow($sql); foreach ($data as $key => $item) { /*if(in_array($item['path'],Fields::$catalogStandart)){ $data[$key][Fields::$types[$item['type']]['type']]=$fields[$item['path']]; }else{*/ if (in_array($data[$key]['path'], $temp)) { unset($data[$key]); } //} } $data = array_merge($data, $additional); if (Funcs::$prop['fieldsort'] == 0) { return $data; } else { $fields = Fields::getFieldsByModule($moduleId); foreach ($fields as $field) { foreach ($data as $item) { if ($field['path'] == $item['path']) { $return[] = $item; } } } return $return; } }
function copy() { $model = new Work(); $parent = $model->copy($_GET['id']); $this->redirect('/work/' . $parent . '/'); }
/** * Modify a work saved in the database. * * @param Work $work * @return integer */ public function editWork(Work $work) { $sql = "UPDATE work \n\t\t\tSET id_work = '" . $work->getIdWork() . "', id_client = '" . $work->getIdClient() . "', work_name = '" . replaceCharacters($work->getWorkName()) . "', location = '" . replaceCharacters($work->getLocation()) . "', principal = '" . replaceCharacters($work->getPrincipal()) . "', date = '" . $work->getDate() . "' WHERE id_work = '" . $work->getIdWork() . "'"; return DB::query($sql); }
function page2($employee_id) { $this->load->helper('settings'); $this->load->library('fpdf'); $this->load->library('fpdi'); // initiate FPDI $pdf = new FPDI('P', 'mm', 'Legal'); // add a page $pdf->AddPage(); // set the sourcefile $pdf->setSourceFile('dtr/template/pds/page2.pdf'); // import page 1 $tplIdx = $pdf->importPage(1); // use the imported page and place it at point 10,10 with a width of 100 mm $pdf->useTemplate($tplIdx, 1, 1, 210); // now write some text above the imported page $pdf->SetFont('Arial'); $pdf->SetTextColor(0, 0, 0); $pdf->SetXY(8, 32); $e = new Eligibility(); //$eligs = $this->Eligibility->get_eligibility($employee_id); $eligs = $e->get_by_employee_id($employee_id); $i = 1; $this->load->helper('text'); foreach ($eligs as $elig) { $pdf->SetFont('Arial', '', 7); $pdf->SetX(8); //$pdf->Write(0, character_limiter($elig->type, 20)); $pdf->Write(0, str_replace('…', '..', character_limiter($elig->type, 25))); //$pdf->MultiCell(51,3,word_wrap($elig->type, 30) ,'',1,'L',true); $pdf->SetX(58); $pdf->Write(0, $elig->rating); $pdf->SetX(75); $pdf->Write(0, $elig->date_exam_conferment); $pdf->SetX(98); $pdf->Write(0, $elig->place_exam_conferment); $pdf->SetX(167); $pdf->Write(0, $elig->license_no); $pdf->SetFont('Arial', '', 8); $pdf->SetX(188); $pdf->Write(0, $elig->license_release_date); $pdf->SetFont('Arial', '', 12); if ($i == 2 || $i == 6) { $pdf->Ln(8); } else { $pdf->Ln(7); } $i++; } //work =================================================================================================== $pdf->SetXY(8, 115); $work = new Work(); // $work->limit(25); $work->order_by('inclusive_date_from', 'DESC'); $works = $work->get_by_employee_id($employee_id); $i = 1; $this->load->helper('text'); foreach ($works as $work) { $pdf->SetFont('Arial', '', 8); $pdf->SetX(7); list($year, $month, $day) = explode('-', $work->inclusive_date_from); $inclusive_date_from = $month . '/' . $day . '/' . $year; $pdf->Write(0, $inclusive_date_from); list($year, $month, $day) = explode('-', $work->inclusive_date_to); $inclusive_date_to = $month . '/' . $day . '/' . $year; if ($work->inclusive_date_to == 'Present') { $inclusive_date_to = 'Present'; } $pdf->SetX(22); $pdf->Write(0, $inclusive_date_to); $pdf->SetFont('Arial', '', 8); $pdf->SetX(39); $pdf->Write(0, str_replace('…', '..', character_limiter($work->position, 20))); $pdf->SetX(75); //$pdf->Write(0, $work->company); $pdf->Write(0, str_replace('…', '..', character_limiter($work->company, 35))); //$pdf->SetFont('Arial', '', 12); $pdf->SetX(132); $pdf->Write(0, $work->monthly_salary); $pdf->SetX(150); $pdf->Write(0, $work->salary_grade); $pdf->SetFont('Arial', '', 8); $pdf->SetX(166); $pdf->Write(0, $work->status); if ($work->govt_service == 1) { $work->govt_service = 'Yes'; } else { $work->govt_service = 'No'; } $pdf->SetX(190); $pdf->Write(0, $work->govt_service); $pdf->SetFont('Arial', '', 12); if ($i == 6 || $i == 10 || $i == 13 || $i == 16 || $i == 19 || $i == 22) { $pdf->Ln(8); } else { $pdf->Ln(7); } if ($i == 25) { //break; $pdf->AddPage(); } $i++; } // Output $pdf->Output('dtr/template/pds/page2_' . $employee_id . '.pdf', 'F'); //header("location:".base_url()."resources/pdfs/archives/page2_".$employee_id.'.pdf'); $this->pds[] = 'dtr/template/pds/page2_' . $employee_id . '.pdf'; }
#! /usr/local/bin/php <?php // test global preferences include_once "test.inc"; $project = new Project(); $user = new User(); $host = new Host($user); $app = new App("uc_slow"); $app_version = new App_Version($app); $project->add_user($user); $project->add_app($app); $project->add_app_version($app_version); $project->install(); // must install projects before adding to hosts $host->log_flags = "log_flags.xml"; $host->add_project($project); $host->global_prefs = "laptop_prefs"; $host->install(); echo "adding work\n"; $work = new Work($app); $work->wu_template = "ucs_wu"; $work->result_template = "uc_result"; array_push($work->input_files, "small_input"); $work->install($project); $project->start_feeder(); echo "Now run the client manually; start and stop it a few times.\n"; //$project->check_results(1, $result); //$project->compare_file("ucs_wu_0_0", "uc_small_correct_output");
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer the ID of the model to be loaded */ public function loadModel($id) { $model = Work::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
/** * Renderize the view. * * @return null */ public function render(array $clients, Work $work) { ?> <p> <?php echo REQUIRED_FIELDS_TEXT; ?> </p> <form action="<?php echo $this->generateURL('work', 'edit', $work->getIdWork()); ?> " method="post"> <fieldset> <div class="row"> <div class="col-md-6"> <div> <label for="id_client"> Socio <small>(*)</small> </label> <select name="id_client" required> <option value=""> Seleccionar </option> <?php foreach ($clients as $client) { if ($client->getIdClient() === $work->getIdClient()) { ?> <option value="<?php echo $client->getIdClient(); ?> " selected> <?php echo $client->getClientName(); ?> </option> <?php } else { ?> <option value="<?php echo $client->getIdClient(); ?> "> <?php echo $client->getClientName(); ?> </option> <?php } } ?> </select> </div> <div> <label for="work_name"> Nombre <small>(*)</small> </label> <input name="work_name" type="text" required value="<?php echo $work->getWorkName(); ?> " /> </div> </div> <div class="col-md-6"> <div> <label for="location"> Ubicación <small>(*)</small> </label> <input name="location" type="text" required value="<?php echo $work->getLocation(); ?> " /> </div> <div> <label for="principal"> Comitente <small>(*)</small> </label> <input name="principal" type="text" required value="<?php echo $work->getPrincipal(); ?> " /> </div> <div> <input type="submit" value="Modificar" /> </div> </div> </div> </fieldset> </form> <?php }
session_destroy(); //redirect login page header("location: ../login.php"); } else { $userLogged = $_SESSION["userLogged"]; } function acquireGetParamethers() { return $_GET["id"]; } $resp = null; $resp = getWorkById(acquireGetParamethers()); if ($resp["response"]) { $workOnGet = $resp["project"]; } else { $workOnGet = new Work(0, 'titolo', 'descrizione', '1991-01-01', 'url', 'avatar'); } ?> <!DOCTYPE html> <html> <head> <?php include_once "admin_head.html"; ?> </head> <body> <?php include_once "admin_navbar.php"; // set the default timezone to use. Available since PHP 5.1
function work($employee_id = '') { $data['page_name'] = '<b>Personal Data Sheet</b>'; $data['section_name'] = '<b>Personal Information</b>'; $data['focus_field'] = 'work_date1'; $data['msg'] = ''; $e = new Employee_m(); $data['employee'] = $e->get_by_id($employee_id); if (Input::get('op')) { // WORK EXPERIENCE================================= $work_date1 = Input::get('work_date1'); $work_date2 = Input::get('work_date2'); $work_position = Input::get('work_position'); $work_office = Input::get('work_office'); $work_salary = Input::get('work_salary'); $work_sg = Input::get('work_sg'); $work_status = Input::get('work_status'); $movement = Input::get('movement'); $work_service = Input::get('work_service'); $work = new Work(); $work->get_by_employee_id($employee_id); $work->delete_all(); $i = 0; foreach ($work_date1 as $work_date) { if ($work_date != "") { $work = new Work(); $work->employee_id = $employee_id; $work->inclusive_date_from = $work_date1[$i]; $work->inclusive_date_to = $work_date2[$i]; $work->position = $work_position[$i]; $work->company = $work_office[$i]; $work->monthly_salary = $work_salary[$i]; $work->salary_grade = $work_sg[$i]; $work->status = $work_status[$i]; $work->movement = $movement[$i]; $work->govt_service = $work_service[$i]; $work->save(); } $i++; } $data['msg'] = 'Work Experience has been saved!'; } // Work============================================================= $work = new Work(); $work->order_by('inclusive_date_from', 'DESC'); $data['works'] = $work->get_by_employee_id($employee_id); $data['govt_service_options'] = array('1' => 'Yes', '0' => 'No'); if ($employee_id == '') { $data['works'] = array(); } $data['selected'] = $e->office_id; // Use for office listbox $data['options'] = $this->options->office_options(); $data['employee_id'] = $employee_id; $data['main_content'] = 'work'; return View::make('includes/template', $data); }
?> <?php echo $form->error($model, 'description'); ?> </div> <br> <div class="row"> <?php echo $form->labelEx($modelRepairWork, 'work_id'); ?> <?php echo $form->dropDownList($modelRepairWork, 'work_id', Chtml::listData(Work::model()->findAll(array('condition' => 'active = 1 AND service_type_id=2', 'order' => 'name')), 'id', 'name'), array('prompt' => 'Seleccionar un trabajo')); ?> <?php echo CHtml::Button('Agregar +', array('id' => 'agregar', 'name' => 'agregar', 'onclick' => 'send();')); ?> <?php echo $form->error($modelRepairWork, 'work_id'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'finished');
/** * */ public function pagework($id) { $work = Work::find($id); $group = Group::find($_GET['group']); return View::make('pages.work')->with('work', $work)->with('group', $group)->with('title', $work->title); }