示例#1
0
 private function getGridData($gridId)
 {
     $grid = array('ID' => $gridId);
     $securityContext = $this->storage->getCurrentUserSecurityContext();
     $parameters = array('with' => array('FILE', 'CREATE_USER'), 'filter' => array('IS_EXPIRED' => false, 'OBJECT.STORAGE_ID' => $this->storage->getId(), 'CREATED_BY' => $this->getUser()->getId()));
     $parameters = Driver::getInstance()->getRightsManager()->addRightsCheck($securityContext, $parameters, array('OBJECT_ID', 'OBJECT.CREATED_BY'));
     $items = ExternalLink::getModelList($parameters);
     Collection::sortByColumn($items, array('CREATE_TIME' => array(SORT_NUMERIC, SORT_ASC)));
     $urlManager = Driver::getInstance()->getUrlManager();
     $rows = array();
     foreach ($items as $externalLink) {
         /** @var ExternalLink $externalLink */
         $exportData = $externalLink->toArray();
         $nameSpecialChars = htmlspecialcharsbx($externalLink->getFile()->getName());
         $createDateText = htmlspecialcharsbx((string) $externalLink->getCreateTime());
         $columnName = "\n\t\t\t\t<table class=\"bx-disk-object-name\"><tr>\n\t\t\t\t\t\t<td style=\"width: 45px;\"><div data-object-id=\"{$externalLink->getId()}\" class=\"draggable bx-file-icon-container-small bx-disk-file-icon\"></div></td>\n\t\t\t\t\t\t<td><a class=\"bx-disk-folder-title\" id=\"disk_obj_{$externalLink->getId()}\" href=\"\" data-bx-dateModify=\"{$createDateText}\">{$nameSpecialChars}</a></td>\n\t\t\t\t</tr></table>\n\t\t\t";
         $createdByLink = \CComponentEngine::makePathFromTemplate($this->arParams['PATH_TO_USER'], array("user_id" => $externalLink->getCreatedBy()));
         $rows[] = array('data' => $exportData, 'columns' => array('CREATE_TIME' => formatDate('x', $externalLink->getCreateTime()->getTimestamp(), time() + CTimeZone::getOffset()), 'UPDATE_TIME' => formatDate('x', $externalLink->getCreateTime()->getTimestamp(), time() + CTimeZone::getOffset()), 'NAME' => $columnName, 'FORMATTED_SIZE' => CFile::formatSize($externalLink->getFile()->getSize()), 'CREATE_USER' => "\n\t\t\t\t\t\t<div class=\"bx-disk-user-link\"><a target='_blank' href=\"{$createdByLink}\" id=\"\">" . htmlspecialcharsbx($externalLink->getCreateUser()->getFormattedName()) . "</a></div>\n\t\t\t\t\t"), 'actions' => array(array("PSEUDO_NAME" => "download", "DEFAULT" => true, "ICONCLASS" => "download", "TEXT" => Loc::getMessage('DISK_EXTERNAL_LINK_LIST_ACT_DOWNLOAD'), "ONCLICK" => "jsUtils.Redirect(arguments, '" . $urlManager->getUrlForDownloadFile($externalLink->getFile()) . "')"), array("PSEUDO_NAME" => "disable_external_link", "ICONCLASS" => "disable_external_link", "TEXT" => Loc::getMessage('DISK_EXTERNAL_LINK_LIST_ACT_DISABLE_EXTERNAL_LINK'), "SHORT_TEXT" => Loc::getMessage('DISK_EXTERNAL_LINK_LIST_ACT_DISABLE_EXTERNAL_LINK_SHORT'), "ONCLICK" => "BX.Disk['ExternalLinkListClass_{$this->getComponentId()}'].disableExternalLink({$externalLink->getId()}, {$externalLink->getObjectId()})")));
     }
     unset($externalLink);
     $grid['MODE'] = 'list';
     $grid['HEADERS'] = array(array('id' => 'ID', 'name' => 'ID', 'default' => false, 'show_checkbox' => true), array('id' => 'NAME', 'name' => Loc::getMessage('DISK_EXTERNAL_LINK_LIST_COLUMN_NAME'), 'default' => true), array('id' => 'CREATE_TIME', 'name' => Loc::getMessage('DISK_EXTERNAL_LINK_LIST_COLUMN_CREATE_TIME'), 'default' => true), array('id' => 'CREATE_USER', 'name' => Loc::getMessage('DISK_EXTERNAL_LINK_LIST_COLUMN_CREATE_USER'), 'default' => false), array('id' => 'FORMATTED_SIZE', 'name' => Loc::getMessage('DISK_EXTERNAL_LINK_LIST_COLUMN_FORMATTED_SIZE'), 'default' => true));
     $grid['ROWS'] = $rows;
     $grid['ROWS_COUNT'] = count($rows);
     $grid['FOOTER'] = array();
     return $grid;
 }
示例#2
0
 /**
  * Name: getData
  * 
  * @param type $url link za paginaciju
  * @param type $cookie_name naziv kolacica
  * @param type $is_archive da li je anketa arhivira ili nije; 1 - jeste, 0 - nije
  */
 function getData($url, $cookie_name, $is_archive = 0)
 {
     $q = get_cookie($cookie_name);
     $perPage = $this->input->post('perPage');
     $perP = $perPage ? $perPage : $q;
     $has_error = 0;
     $message = __('Uspesno dobavljeni podaci!!', $this->template['module']);
     // var_dump($message); exit;
     if (is_numeric($this->anketa->getTotalRows($is_archive))) {
         pagination($url, $this->anketa->getTotalRows($is_archive), $perP, '4', 'ankete');
     } else {
         $has_error = 2;
         $message = "Doslo je do greske.";
     }
     $page = uri_segment('4');
     if (!($data = $this->anketa->fetch_ankete($perP, $page, $is_archive))) {
         $has_error = 1;
         $message = __('Trenutno nema anketa!!! Unesite anketu klikom na', $this->template['module']);
     }
     if (!empty($data)) {
         $redni_broj = isset($page) ? $page : 0;
         foreach ($data as $anketa) {
             $anketa->datum_kreiranja = formatDate($anketa->datum_kreiranja);
             $anketa->redni_broj = ++$redni_broj;
         }
     }
     $links = create_links();
     $uri = $page;
     $result = array('data' => $data, 'links' => $links, 'error' => $has_error, 'uri' => $uri, 'poruka' => $message);
     $this->response($result);
 }
示例#3
0
 function testa_user($s_usuario, $s_nivel, $s_nivel_desc, $permissao, $help = '')
 {
     if (!isset($_SESSION['s_logado']) || $_SESSION['s_logado'] == 0) {
         print "<script>window.open('../../index.php','_parent','')</script>";
         exit;
     } else {
         //print "<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>";
         if ($help != '') {
             $help = "&nbsp;<a><img align='absmiddle' src='" . ICONS_PATH . "help-16.png' width='16' height='16' border='0' onClick=\"return popupS('" . HELP_PATH . "" . $help . "')\"></a>";
         }
         if ($s_nivel > $permissao) {
             $this->saida = "<script>window.open('../../index.php','_parent','')</script>";
             exit;
         } else {
             if (is_file("./.invmon_dir")) {
                 $this->texto = TRANS('MENU_TTL_MOD_INV');
             } else {
                 if (is_file("./.admin_dir")) {
                     $this->texto = TRANS('MENU_TTL_MOD_ADMIN');
                 } else {
                     $this->texto = TRANS('MENU_TTL_MOD_OCCO');
                 }
             }
             $this->saida = "<TABLE class='header_centro' cellspacing='1' border='0' cellpadding='1' align='center' width='100%'>" . "<TR>" . "<TD nowrap width='75%'><b>" . $this->texto . "</b></td>" . "<td width='25%' nowrap><p class='parag' align='right'><b>" . TRANS(date("l")) . ",&nbsp;" . formatDate(date("Y/m/d H:i"), " %H:%M") . "</b>" . $help . "</p></TD>";
             $this->saida .= "</TR>" . "</TABLE>";
         }
         print $this->saida;
     }
 }
示例#4
0
 /**
  * Returns (safe) HTML which displays a field
  * @access public
  * @param array $task task data
  * @param array $parents parents for a category item
  * @param bool $plain this is **not** meant to be safe, but basically to display content where HTML tags are disturbing
  * @return string
  */
 function view($task = array(), $parents = array(), $plain = false)
 {
     if (!isset($task['field' . $this->id]) || !$task['field' . $this->id]) {
         $html = sprintf('<span class="fade">%s</span>', eL('notspecified'));
     } else {
         $html = '';
         switch ($this->prefs['field_type']) {
             case FIELD_LIST:
                 if ($this->prefs['list_type'] == LIST_CATEGORY && isset($parents[$this->id])) {
                     foreach ($parents[$this->id] as $cat) {
                         $html .= Filters::noXSS($cat) . '&#8594;';
                     }
                 }
                 $html .= Filters::noXSS($task['field' . $this->id . '_name']);
                 break;
             case FIELD_DATE:
                 $html .= formatDate($task['field' . $this->id]);
                 break;
             case FIELD_TEXT:
                 $html .= Filters::noXSS($task['field' . $this->id]);
                 break;
             case FIELD_USER:
                 $html .= Filters::noXSS($task['field' . $this->id . '_name']);
                 break;
         }
     }
     return $plain ? strip_tags(htmlspecialchars_decode($html, ENT_QUOTES)) : $html;
 }
示例#5
0
function getExperienceEnd($date)
{
    if ($date == 0) {
        return "Present";
    } else {
        return formatDate($date);
    }
}
示例#6
0
function prepareComment($msg, $timestamp, $uid, $cid, $event_id)
{
    $date = formatDate($timestamp);
    // $time = formatDate($timestamp);
    $name = getUserName($uid);
    $msg = formatMsg($msg);
    $delbtn = deleteBtnComment($cid, $uid, $event_id);
    return "<div class='eventComment'>\n                <span style='font-size:50%;'>\n                    <span>{$date}</span>\n                    &nbsp;&nbsp;\n                    |\n                    &nbsp;&nbsp;\n                    <span style='font-size:75%;'>\n                        {$name}</span>\n                    </span>\n                    <span>\n                        {$delbtn}\n                        </span>\n                <br />\n                <span class='eventCommentText'>\n                    " . strip_tags($msg) . "\n                </span>\n            </div>\n            ";
}
function dayReferance($date, $format = "d-m-Y")
{
    if (formatDate($date) == formatDate(getCurrentDateTime())) {
        return "Today";
    } elseif (formatDate($date) == formatDate(getPreviousDate(getCurrentDateTime()))) {
        return "Yesterday";
    } else {
        return formatDate($date, $format);
    }
}
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     //
     $data = Input::All();
     $data['tanggal'] = formatDate($data['tanggal']);
     $riwayat = new Seminar($data);
     if ($riwayat->save()) {
         return Response::json(array('success' => true));
     }
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     //
     $data = Input::All();
     $data['tanggal_sertifikat'] = formatDate($data['tanggal_sertifikat']);
     $riwayat = new PelatihanPegawai($data);
     if ($riwayat->save()) {
         return Response::json(array('success' => true));
     }
 }
示例#10
0
文件: Comment.php 项目: kizz66/meat
 public function getList($newsletterID = 0)
 {
     $db = MySQL::getInstance();
     $db->query("SELECT c.CommentID, c.Content, c.LeftKey, u.Name, u.Email, c.Created,\n\t\t\t\tIF (c.Level > 20, 20, c.Level) AS Level\n\t\t\tFROM `newsletter_comment` AS c\n\t\t\t\tINNER JOIN `newsletter` AS n ON n.NewsletterID = c.NewsletterID\n\t\t\t\tINNER JOIN `user` AS u ON c.UserID = u.UserID\n\t\t\tWHERE c.NewsletterID=" . $db->escape((int) $newsletterID) . "\n\t\t\tORDER BY c.LeftKey");
     $items = array();
     while ($row = $db->fetchRow()) {
         $row['Date'] = formatDate($row['Created'], 'j F Y в H:i');
         $items[] = $row;
     }
     return new Object($items);
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     //
     $data = Input::All();
     $data['tanggal_sttb'] = formatDate($data['tanggal_sttb']);
     $data['tanggal_lulus'] = formatDate($data['tanggal_lulus']);
     $pendidikan = new Pendidikan($data);
     if ($pendidikan->save()) {
         return Response::json(array('success' => true));
     }
 }
示例#12
0
function editperiod_GET(Web $w)
{
    list($periodid) = $w->pathMatch("a");
    $period = new BendWorkPeriod($w);
    if (!empty($periodid)) {
        $period = $w->Bend->getWorkPeriodForId($periodid);
    }
    $form["Work Period"] = array(array(array("Date From", "date", "d_start", !empty($period->d_start) ? formatDate($period->d_start) : ""), array("Date To", "date", "d_end", !empty($period->d_end) ? formatDate($period->d_end) : "")), array(array("Monthly Person Hours", "text", "monthly_person_hours", $period->monthly_person_hours), array("Is Closed?", "select", "is_closed", $period->is_closed, booleanNoYesForSelect())));
    $w->setLayout(null);
    $w->out(Html::multiColForm($form, "/bend-workhours/editperiod/{$periodid}", "POST", "Save"));
}
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     //
     $data = Input::All();
     $data['tanggal_sk'] = formatDate($data['tanggal_sk']);
     $data['tanggal_mulai'] = formatDate($data['tanggal_mulai']);
     $data['tanggal_selesai'] = formatDate($data['tanggal_selesai']);
     $riwayat = new RiwayatJabatan($data);
     if ($riwayat->save()) {
         return Response::json(array('success' => true));
     }
 }
示例#14
0
function showperiod_GET(Web $w)
{
    list($id) = $w->pathMatch("a");
    $wp = $w->Bend->getWorkperiodForId($id);
    if (empty($wp)) {
        $w->error("Workperiod does not exist", "/bend-workhours/admin");
    }
    History::add("Work Period: " . formatDate($wp->d_start));
    $w->ctx("workperiod", $wp);
    $w->ctx("categories", $w->Bend->getTopLevelWorkCategories());
    $w->ctx("households", $w->Bend->getAllHouseholds());
}
示例#15
0
文件: Menu.php 项目: babesk/babesk
 public function execute($dataContainer)
 {
     //No direct access
     defined('_WEXEC') or die("Access denied");
     require_once PATH_ACCESS . '/GlobalSettingsManager.php';
     require_once PATH_ACCESS . '/OrderManager.php';
     require_once PATH_ACCESS . '/MealManager.php';
     $smarty = $dataContainer->getSmarty();
     $orderManager = new OrderManager('BabeskOrders');
     $mealManager = new MealManager('BabeskMeals');
     $meal = array();
     $orders_existing = true;
     $meal_problems = false;
     $mealHistory = array();
     try {
         $orders = $orderManager->getAllOrdersOfUser($_SESSION['uid'], strtotime(date('Y-m-d')));
     } catch (MySQLVoidDataException $e) {
         $smarty->assign('error', 'Keine Bestellungen vorhanden.');
         $orders_existing = false;
     } catch (Exception $e) {
         die('Error: ' . $e);
     }
     if ($orders_existing) {
         $today = date('Y-m-d');
         $hour = date('H', time());
         $this->_lastCancel = $this->lastOrdercancelDatemodGet();
         foreach ($orders as $order) {
             try {
                 $mealname = $mealManager->getEntryData($order['MID'], 'name');
             } catch (MySQLVoidDataException $e) {
                 $meal_problems = true;
                 $smarty->assign('error', '<p class="error">Zu bestimmten Bestellung(-en) fehlen Daten einer Mahlzeit! Bitte benachrichtigen sie den Administrator!</p>');
                 continue;
             }
             if (!$order['fetched'] and $order['date'] >= $today) {
                 //fetch last_order_time from database and compare with actual time
                 $hour = date('H:i', time());
                 $cancelAllowed = $this->isAllowedToCancel($order['date']);
                 $meal[] = array('date' => formatDate($order["date"]), 'name' => $mealname["name"], 'orderID' => $order['ID'], 'cancel' => $cancelAllowed);
             } else {
                 $mealHistory[] = array('date' => formatDate($order["date"]), 'name' => $mealname["name"], 'orderID' => $order['ID'], 'cancel' => false, 'fetched' => $order['fetched']);
             }
         }
     }
     if (!count($meal) && !count($mealHistory) && !$meal_problems) {
         //no new meals there
         $smarty->assign('error', 'Keine Bestellungen vorhanden.');
     }
     $smarty->assign('meal', $meal);
     $smarty->assign('mealHistory', $mealHistory);
     $smarty->display($this->smartyPath . 'menu.tpl');
 }
示例#16
0
 public function getTagHeadline($whereCond = '', $offset = 0, $limit = 5)
 {
     if ($whereCond) {
         $this->where($whereCond);
     }
     $this->limit($offset, $limit);
     $this->orderby(array('tag_order' => 'ASC'));
     $row = $this->get($this->table);
     foreach ($row as $no => $r) {
         $row[$no]['date_modified_formated'] = formatDate($r['date_modified'], 2);
     }
     return $row;
 }
示例#17
0
function getLast12Months($format = "%b %Y")
{
    $currentDate = today();
    $currentMonth = formatDate($currentDate, "%m");
    $currentYear = formatDate($currentDate, "%Y");
    $startingYear = $currentYear - 1;
    $last_12_months = array();
    for ($i = (int) $currentMonth + 1; $i <= 12; $i++) {
        $last_12_months[] = formatDate($startingYear . "-" . $i . "-01", $format);
    }
    for ($i = 1; $i <= $currentMonth; $i++) {
        $last_12_months[] = formatDate($currentYear . "-" . $i . "-01", $format);
    }
    return $last_12_months;
}
示例#18
0
function editworkentry_GET(Web $w)
{
    list($workentry_id) = $w->pathMatch("id");
    if (empty($workentry_id)) {
        $w->error("Missing an ID");
    }
    $workentry = $w->Bend->getWorkEntryForId($workentry_id);
    if (empty($workentry)) {
        $w->error("No work entry found for this id: " . $workentry_id);
    }
    $category = $workentry->getWorkCategory();
    list($category_1, $category_2, $category_3) = $category->getPath();
    $form["Work Hours"] = array(array($w->Auth->hasRole("bend_admin") ? array("Who did the work?", "select", "user_id", $workentry->user_id, $w->Bend->getOccupantUsers()) : array("Who did the work?", "static", "", $w->Auth->getUser($workentry->user_id)->getFullName()), array("Who to credit to", "select", "attributed_user_id", $workentry->attributed_user_id, $w->Bend->getOccupantUsers()), array("Date", "date", "d_date", formatDate($workentry->d_date)), array("Hours", "text", "hours", $workentry->hours)), array(array("Focus Group", "select", "category_1", defaultVal($category_1->id), $w->Bend->getTopLevelWorkCategories()), array("Team or Activity", "select", "category_2", defaultVal($category_2->id), !empty($category_1) ? $category_1->getChildren() : null), array("Activity", "select", "category_3", defaultVal($category_3->id), !empty($category_2) ? $category_2->getChildren() : null)), array(array("Description", "text", "description", $workentry->description)));
    $w->ctx("form", Html::multiColForm($form, "/bend-workhours/editworkentry/{$workentry_id}", "POST", "Save"));
}
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     //
     $data = Input::All();
     $data['tanggal_sk'] = formatDate($data['tanggal_sk']);
     $data['tanggal_mulai'] = formatDate($data['tanggal_mulai']);
     $data['tanggal_selesai'] = formatDate($data['tanggal_selesai']);
     $diff = getDateDiff($data['tanggal_mulai'], $data['tanggal_selesai']);
     if ($diff->y > 0) {
         $data['masa_berlaku'] = $diff->y . ' Tahun ' . $diff->m . ' Bulan';
     }
     $riwayat = new HukumanPegawai($data);
     if ($riwayat->save()) {
         return Response::json(array('success' => true));
     }
 }
示例#20
0
 public function getByID($newsletterID)
 {
     $db = MySQL::getInstance();
     $db->query("SELECT n.*, IF (c.Count, c.Count, 0) AS CommentCount\n\t\t\tFROM newsletter AS n\n\t\t\t\tLEFT JOIN newsletter_comment_count AS c ON c.NewsletterID = n.NewsletterID\n\t\t\tWHERE n.NewsletterID = " . $db->escape((int) $newsletterID));
     $item = array();
     if ($db->numRows() > 0) {
         $item = $db->fetchRow();
         $item['DateFormat'] = formatDate($item['Date'], 'Y-m-d');
         $oCommentList = new Newsletter_Comment();
         $item['CommentList'] = $oCommentList->getList((int) $newsletterID);
         $oImageList = new Newsletter_Image();
         $item['ImageList'] = $oImageList->getList((int) $newsletterID);
     } else {
         return false;
     }
     return new Object($item);
 }
示例#21
0
 public function afterFind($results, $primary = false)
 {
     foreach ($results as $key => $val) {
         if (isset($val[$this->alias]['date_joined']) && $val[$this->alias]['date_joined'] != '0000-00-00 00:00:00') {
             $results[$key][$this->alias]['date_joined'] = formatDate($val[$this->alias]['date_joined']);
         }
         if (isset($val[$this->alias]['last_login']) && $val[$this->alias]['last_login'] != '0000-00-00 00:00:00') {
             $results[$key][$this->alias]['last_login'] = formatDate($val[$this->alias]['last_login']);
         } else {
             $results[$key][$this->alias]['last_login'] = __('Never');
         }
         // if (isset($val[$this->alias]['active'])){
         // $states = $this->stateOptions();
         // $results[$key][$this->alias]['active'] = $states[$results[$key][$this->alias]['active']];
         // }
     }
     return $results;
 }
 public function edit($id)
 {
     $this->Deliverable->id = $id;
     if (!$this->Deliverable->exists()) {
         throw new NotFoundException(__('Invalid Deliverable'));
     }
     // Deliverable fields: 	id name type 0: free 1: not free date project_id no_of_changes
     if ($this->request->is(array('post', 'put'))) {
         $this->request->data['Deliverable']['id'] = $id;
         if ($this->Deliverable->saveAll($this->request->data)) {
             $this->Session->setFlash(__('The Deliverable has been saved'));
             $this->redirect(array('action' => 'index'));
         }
     } else {
         $this->request->data = $this->Deliverable->read(null, $id);
         $this->request->data['Deliverable']['date'] = formatDate($this->request->data['Deliverable']['date']);
     }
 }
示例#23
0
	public function getSurveyDetails($bID, $cID) {				
		// Load the data from the database
		$db = Loader::db();
		$v = array(intval($bID), intval($cID));
		$q = 
			'SELECT 
				btSurveyOptions.optionName, Users.uName, ipAddress, timestamp, question 
			FROM 
				btSurveyResults, Users, btSurveyOptions, btSurvey
			WHERE
				Users.uID = btSurveyResults.uID AND
				btSurveyOptions.optionID = btSurveyResults.optionID AND
				btSurvey.bID= btSurveyResults.bID AND
				btSurveyResults.bID = ? AND
				btSurveyResults.cID = ?';
		$r = $db->query($q, $v);
		
		// Set default information in case query returns nothing
		$current_survey = 'Unknown Survey';
		$details = array();
		
		if ($row = $r->fetchRow()) {
			// Build array of information we need
			$i = 0;
			foreach ($r as $row) {
				$details[$i]['option'] = $row['optionName'];
				$details[$i]['ipAddress'] = $row['ipAddress'];
				$details[$i]['date'] = formatDate($row['timestamp']);
				$details[$i]['user'] = $row['uName'];
				$current_survey = $row['question'];
				$i++;
			}
		} else { // If there is no user-submitted information pertaining to this survey, just get the name
			$q = 'SELECT question FROM btSurvey WHERE bID = ?';
			$v = array($bID);
			$r = $db->query($q, $v);
			if ($row = $r->fetchRow()) {
				$current_survey = $row['question'];
			}
		}
		// Store local data in larger scope
		$this->set('survey_details', $details);
		$this->set('current_survey', $current_survey);
	}
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     //
     $destinationPath = public_path() . '/upload';
     $data = Input::except('file');
     $data['tanggal_lahir'] = formatDate($data['tanggal_lahir']);
     $data['tanggal_pengangkatan_cpns'] = formatDate($data['tanggal_pengangkatan_cpns']);
     $data["tanggal_sk_pangkat"] = formatDate($data['tanggal_sk_pangkat']);
     $data["tanggal_mulai_pangkat"] = formatDate($data['tanggal_mulai_pangkat']);
     $data["tanggal_selesai_pangkat"] = formatDate($data['tanggal_selesai_pangkat']);
     $pegawai = new Pegawai($data);
     if (Input::hasFile('file')) {
         Input::file('file')->move($destinationPath);
         $pegawai->foto = Input::file('file')->getClientOriginalName();
     }
     if ($pegawai->save()) {
         return Response::json(array('success' => TRUE));
     }
 }
示例#25
0
function displayTranslation($id, $src)
{
    global $doc, $table;
    $src = e($src);
    $res = "\r\n        <div id='view'>\r\n        <div class='text'>{$src}</div>\r\n        <ol id='revisions'>";
    $qq = "\r\n        select t1.translation as translation, t1.revision as revision, t1.revert_to as revert_to, t1.comment as comment, t1.user_id as user_id, if(t1.user_id = 0, ip.id, u1.name) as name, unix_timestamp(t1.date) as _date\r\n        from {$table['translation']} t1 left join {$table['ip_data']} ip on t1.user_ip = ip.ip left join {$table['user']} u1 on t1.user_id = u1.id\r\n        where t1.source_id = ? order by t1.id desc;\r\n    ";
    $q = query($qq, $id);
    $i = 0;
    while ($row = $q->fetch(MYSQL_ASSOC)) {
        ++$i;
        $name = constructName($row['user_id'], $row['name']);
        $comment = $row['comment'] ? "<div class='comment'>" . f($row[comment]) . '</div>' : "";
        if ($row['revert_to'] == -1) {
            $revtype = 'Deleted';
            $text = '';
        } else {
            $text = "<div class='text'>" . f($row['translation']) . "</div>";
            if ($row['revert_to'] != 0) {
                $revtype = "Reverted to revision <a href='#{$row['revert_to']}'>{$row['revert_to']}</a>";
            } else {
                $revtype = "Submitted";
            }
        }
        $date = formatDate($row['_date']);
        if ($i > 1 && $row['revert_to'] != -1) {
            $revert = "\r\n                <div style='display: inline'>\r\n                <button class='revert'>Revert to this</button>\r\n                <form class='revertform' method='post' action='submit.php'>\r\n                <div class='fields'>\r\n                <label>Why do you want to revert the translation?<br>\r\n                <textarea name='comment'></textarea>\r\n                </label><br>\r\n                </div>\r\n                <input type='submit' value='Revert translation' />\r\n                <input type='hidden' name='src_id' value='{$id}' />\r\n                <input type='hidden' name='revert_to' value='{$row['revision']}' />\r\n                <input type='hidden' name='from' value='site' />\r\n                </form> \r\n                </div> \r\n            ";
        } else {
            $revert = "";
        }
        $res .= "\r\n            <a name='{$row['revision']}'></a>\r\n            <li value='{$row['revision']}'>\r\n            {$revtype} by {$name} on {$date}. {$revert}\r\n            {$text}\r\n            {$comment}\r\n            </li>\r\n        ";
        if ($i == 1) {
            $res .= "</ol>" . constructSubmitForm($id) . "<ol id='revisions'>";
        }
    }
    $res .= "</ol>";
    if ($i == 0) {
        $res .= constructSubmitForm($id);
    }
    $res .= "</div>";
    $res .= "\r\n        <script>\r\n        function toggleRevertForm(ev)\r\n        {\r\n            \$(this).parent().find('form.revertform').toggle();\r\n        }\r\n        \r\n        \$(function()\r\n        {\r\n            \$('button.revert').click(toggleRevertForm);\r\n        });\r\n        </script>\r\n    ";
    $doc->content = $res;
}
示例#26
0
 function get_imageList($where = '', $limit = array())
 {
     if ($where) {
         $this->where($where);
     }
     if ($limit) {
         $this->limit($limit[0], $limit[1]);
     }
     $sql = $this->table($this->table)->orderby("photo_id", "DESC")->where("photo_path!=''")->create_query();
     $row = $this->query($sql)->fetchrow();
     foreach ($row as $no => $r) {
         $row[$no]['photo_date_formated'] = formatDate($r['photo_date'], 2, false);
         $row[$no]['photo_entry_formated'] = formatDate($r['photo_entry'], 2, false);
         // $row[$no]['photo_thumb_url'] = $this->config['klimg_url'] . $r['photo_path'] . '200xauto-' . $r['photo_url'];
         // $row[$no]['crop_url'] = $this->config['base_url'] . $this->ctrler . '/cropPopup/&id=' . $r['photo_id'] . '&t=' . date('s');
         $row[$no]['photo_thumb_url'] = Config::App()->get('klimg_url') . $r['photo_path'] . '200xauto-' . $r['photo_url'];
         $row[$no]['crop_url'] = Config::App()->get('base_url') . $this->ctrler . '/cropPopup/&id=' . $r['photo_id'] . '&t=' . date('s');
     }
     return $row;
 }
示例#27
0
function editoccupant_GET(Web $w)
{
    list($householdid, $occupantid) = $w->pathMatch("a", "b");
    if (empty($householdid)) {
        $w->error("Need a household ID");
    }
    $household = $w->Bend->getHouseholdForId($householdid);
    if (empty($household)) {
        $w->error("Household not found");
    }
    $oc = new BendHouseholdOccupant($w);
    $contact = new Contact($w);
    if (!empty($occupantid)) {
        $oc = $w->Bend->getHouseholdOccupantForId($occupantid);
        $contact = $oc->getContact();
    }
    $form["Household"] = array(array(array("Street Number", "static", "", $household->streetnumber), array("Is CHL?", "static", "", $household->is_chl ? "yes" : "no"), array("Is Occupied?", "static", "", $household->is_occupied ? "yes" : "no")));
    $form["Occupant"] = array(array(array("Occupant From", "date", "d_start", !empty($oc->d_start) ? formatDate($oc->d_start) : ""), array("Occupant To", "date", "d_end", !empty($oc->d_end) ? formatDate($oc->d_end) : "")), array(array("Pays Electricity?", "select", "pays_electricity", $oc->pays_electricity, lookupForSelect($w, "YesNo")), array("Does Workhours?", "select", "does_workhours", $oc->does_workhours, lookupForSelect($w, "YesNo"))));
    $form["Occupant Contact"] = array(array(empty($oc->user_id) ? array("Select Existing User", "select", "user_id", null, $w->Auth->getUsers()) : array("User", "static", "", $oc->getFullName())), array(array("First Name", "text", "firstname", $contact->firstname), array("Last Name", "text", "lastname", $contact->lastname), array("Email", "text", "email", $contact->email)), array(array("Home Phone", "text", "homephone", $contact->homephone), array("Work Phone", "text", "workphone", $contact->workphone), array("Mobile Phone", "text", "mobile", $contact->mobile)));
    $w->ctx("form", Html::multiColForm($form, "/bend-household/editoccupant/{$householdid}/{$occupantid}", "POST", "Save"));
}
示例#28
0
function editlotowner_GET(Web $w)
{
    list($lotId, $lotOwnerId) = $w->pathMatch("lotId", "lotOwnerId");
    if (empty($lotId)) {
        $w->out("no lot id provided");
        return;
    }
    $lot = $w->Bend->getLotForId($lotId);
    $lotOwner = new BendLotOwner($w);
    $user = new User($w);
    $contact = new Contact($w);
    if (!empty($lotOwnerId)) {
        $lotOwner = $w->Bend->getBendLotOwnerForId($lotOwnerId);
        $user = $lotOwner->getUser();
        $contact = $lotOwner->getContact();
    }
    $form["Lot"] = array(array(array("Lot Number", "static", "", $lot->lot_number), array("Occupancy", "static", "", $lot->occupancy)), array(array("Owner From", "date", "d_start", !empty($lotOwner->d_start) ? formatDate($lotOwner->d_start) : ""), array("Owner To", "date", "d_end", !empty($lotOwner->d_end) ? formatDate($lotOwner->d_end) : "")));
    $form["Owner Contact"] = array(array(empty($lotOwner->user_id) ? array("Select Existing User", "select", "user_id", null, $w->Auth->getUsers()) : array("User", "static", "", $lotOwner->getContact()->getFullName())), array(array("First Name", "text", "firstname", $contact->firstname), array("Last Name", "text", "lastname", $contact->lastname), array("Email", "text", "email", $contact->email)), array(array("Home Phone", "text", "homephone", $contact->homephone), array("Work Phone", "text", "workphone", $contact->workphone), array("Mobile Phone", "text", "mobile", $contact->mobile)));
    $form["Owner Address"] = array(array(array("Address1", "text", "address1", $lotOwner->address1), array("Address2", "text", "address2", $lotOwner->address2)), array(array("Town", "text", "town", $lotOwner->town), array("Postcode", "text", "postcode", $lotOwner->postcode), array("State", "select", "state", $lotOwner->state, getStateSelectArray())));
    $w->ctx("form", Html::multiColForm($form, "/bend-lot/editlotowner/{$lotId}/{$lotOwnerId}", "POST", "Save"));
}
示例#29
0
 function editor()
 {
     $date_now = date("Y-m-d H:i:s");
     $date_last = date("Y-m-d H:i:s", strtotime("-60 days"));
     $where = "news_date_publish <= '{$date_now}' AND news_date_publish >= '{$date_last}' AND news_level != 0";
     $row = $this->news_model->get_data_news($where, 'all', '0', '10', 'news');
     $row = $this->gen_full_url_image($row);
     $tmp = array();
     foreach ($row as $rs) {
         $tgl = date("Y-m-d", strtotime($rs['news_date_publish']));
         $editor = json_decode($rs['news_editor'], true);
         $categori = $editor[0]['user_fullname'];
         if ($categori != '') {
             $tmp[$tgl][$categori][] = $rs;
         }
     }
     $reporter = $this->user_model->get_user_bycondition("user_level_id='5'");
     //echoPre($reporter);
     foreach ($reporter as $rep) {
         if ($rep != "product") {
             $opt_rep[$rep['user_id']] = ($rep['user_id'] == $this->search['rep'] ? '#' : '') . $rep['user_realname'];
         }
     }
     $data = $datas = array();
     $table = '<table><tr><th>Tanggal</th><th>Categori</th><th>Total</th></tr>';
     foreach ($tmp as $tgl => $cat) {
         $tgl = formatDate($tgl . " 00:00:00", 3, false);
         foreach ($opt_rep as $rep) {
             $table .= '<tr>
                         <td>' . $tgl . '</td>
                         <td>' . $rep . '</td>
                         <td>' . (isset($cat[$rep]) ? count($cat[$rep]) : 0) . '</td>
                         </tr>';
         }
     }
     $table .= '</table>';
     header("Content-type: application/vnd-ms-excel");
     header("Content-Disposition: attachment; filename=news-export-editor.xls");
     echo $table;
 }
示例#30
0
 function table()
 {
     $this->DB->query("SELECT COUNT(*) as TOTAL FROM " . $this->table_name);
     $result = $this->DB->get_first('array');
     $iTotalRecords = $result ? $result['TOTAL'] : 0;
     $where = '';
     $order = ($_REQUEST['iSortCol_0'] ? $_REQUEST['sSortDir_0'] : 'varName') . ' ' . ($_REQUEST['sSortDir_0'] ? $_REQUEST['sSortDir_0'] : 'ASC');
     $limit = '';
     if ($_REQUEST['sSearch']) {
         $where = 'varName LIKE "%' . $_REQUEST['sSearch'] . '%"';
     }
     if ($_REQUEST['iDisplayStart']) {
         $limit = $_REQUEST['iDisplayStart'] . ',' . $_REQUEST['iDisplayLength'];
     } else {
         $limit = '0,' . $_REQUEST['iDisplayLength'];
     }
     $this->DB->query("SELECT COUNT(*) as TOTAL FROM " . $this->table_name . " " . ($where ? 'WHERE ' . $where : ''));
     $result = $this->DB->get_first('array');
     $iTotalDisplayRecords = $result ? $result['TOTAL'] : 0;
     $orderP = 'id';
     $orderD = 'DESC';
     $sortArray = array('id', 'varName', 'varColor', 'dateUpdate');
     if ($_REQUEST['iSortCol_0'] && array_key_exists($_REQUEST['iSortCol_0'], $sortArray)) {
         $orderP = $sortArray[$_REQUEST['iSortCol_0']];
     }
     if ($_REQUEST['sSortDir_0']) {
         $orderD = $_REQUEST['sSortDir_0'];
     }
     $this->DB->select($this->table_name, $orderP . ' ' . $orderD, $where, '*', $limit);
     $regs = $this->DB->get('array');
     $aaData = array();
     if ($regs) {
         foreach ($regs as $r) {
             $aaData[] = array($r['id'], '<a itemid="' . $r['id'] . '" itemref="Color" href="' . MALETEKPL__BACKEND_CONTROLLER . '?controller=color&action=edit" class="editReg">' . $r['varName'] . '</a>', '<a href="' . MALETEKPL__PLUGIN_URL . 'resources/color/' . $r['varImage'] . '" class="fancybox">Ver</a>', formatDate($r['dateUpdate']), '<input itemid="' . $r['id'] . '" itemref="Color" type="button" class="button deleteReg" value="Eliminar" />');
         }
     }
     $output = array("sEcho" => intval($_REQUEST['sEcho']), "iTotalRecords" => $iTotalRecords, "iTotalDisplayRecords" => $iTotalDisplayRecords, "aaData" => $aaData);
     exit(json_encode($output));
 }