protected function log_relation_name($object) { $name = short_name($object) . ' ID#' . $object->id; if (isset($object->name) && $object->name) { $name .= ' Name: ' . $object->name; } return $name; }
public static function boot() { parent::boot(); // Delete all links when deleting any LinkableModel. static::deleting(function ($model) { with(App::make('MenuItem'))->where('fmodel', short_name($model))->where('fid', $model->id)->delete(); }); }
function real_name($name, $type) { //去掉左右两侧的$type表示的字符串 $name = str_ireplace($type, "", $name); //去掉两侧多余的下划线 $name = trim($name, "_"); if (preg_match("/^[0-9]+/", $name)) { if ($type == 'text') { return null; } else { return short_name($type) . $name; } } else { return $name . "_" . short_name($type); } }
public function get_data() { $page = intval($this->uri->segment(3)); $per_page = 10; $offset = $page == 0 ? $page : $page * $per_page - $per_page; $data = $this->db->select('o.id, b.id_marker, b.profile AS profile_bengkel, b.latlng AS latlng_bengkel, o.created, o.type, o.latlng AS latlng_order, o.status, o.detail_order,')->from('beo_order AS o')->join('beo_customer AS c', 'o.customer_id = c.id', 'left')->join('beo_bengkel AS b', 'o.bengkel_id = b.id', 'left')->where('o.customer_id', $this->customer_id)->order_by('o.created', 'desc')->limit($per_page, $offset)->get(); $total = $this->db->where('customer_id', $this->customer_id)->get('beo_order')->num_rows(); $status = array('waiting', 'process', 'confirm', 'cancel', 'done'); $result = array(); foreach ($data->result() as $v) { $profile_bengkel = json_decode($v->profile_bengkel); $latlng_bengkel = json_decode($v->latlng_bengkel); $latlng_order = json_decode($v->latlng_order); $detail_order = json_decode($v->detail_order); $result[] = array('id' => intval($v->id), 'logo_bengkel' => short_name($profile_bengkel->name), 'name_bengkel' => $profile_bengkel->name, 'date_order' => $v->created, 'status_order' => intval($v->status), 'status_order_text' => $status[$v->status], 'damage_order' => $detail_order->damage, 'detail_bengkel' => array('id_marker' => floatval($v->id_marker), 'company' => $profile_bengkel->company, 'contact' => $profile_bengkel->contact, 'email' => $profile_bengkel->email, 'location' => $profile_bengkel->location, 'price' => $profile_bengkel->price, 'lat' => $latlng_bengkel->lat, 'lng' => $latlng_bengkel->lng), 'detail_order' => array('detail_location' => $detail_order->detail_location, 'lat' => $latlng_order->lat, 'lng' => $latlng_order->lng, 'distance' => $detail_order->distance, 'total_price' => $detail_order->total_price)); } $output['ok'] = 1; $output['result'] = array('list' => $result, 'per_page' => $per_page, 'total_data' => $total, 'total_page' => ceil($total / $per_page)); pretty_json($output); }
/** * Takes an array of users and returns them in an array with a * key => short_name relationship * * @param $users * @return array */ function short_name_array($users) { uasort($users, 'user_last_name_sort'); $arr = []; foreach ($users as $key => $user) { $arr[$key] = short_name($user); } return $arr; }
function leedStats_plugin_setting_bloc(&$myUser) { $configurationManager = new Configuration(); $configurationManager->getAll(); echo ' <section id="leedStatslBloc" class="leedStatslBloc" style="display:none;"> <h2>' . _t('P_LEEDSTATS_TITLE') . '</h2> <section class="preferenceBloc"> <h3>' . _t('P_LEEDSTATS_RESUME') . '</h3> '; //Nombre global d'article lus / non lus / total / favoris $requete = 'SELECT (SELECT count(1) FROM `' . MYSQL_PREFIX . 'feed`) as nbFeed, (SELECT count(1) FROM `' . MYSQL_PREFIX . 'event` WHERE unread = 1) as nbUnread, (SELECT count(1) FROM `' . MYSQL_PREFIX . 'event` WHERE unread = 0) as nbRead, (SELECT count(1) FROM `' . MYSQL_PREFIX . 'event`) as nbTotal, (SELECT count(1) FROM `' . MYSQL_PREFIX . 'event` WHERE favorite = 1) as nbFavorite '; $query = mysql_query($requete); if ($query != null) { echo '<div id="result_leedStats1" class="result_leedStats1"> <table> <th class="leedStats_border leedStats_th">' . _t('P_LEEDSTATS_NBFEED') . '</th> <th class="leedStats_border leedStats_th">' . _t('P_LEEDSTATS_NBART') . '</th> <th class="leedStats_border leedStats_th">' . _t('P_LEEDSTATS_NBART_NONLU') . '</th> <th class="leedStats_border leedStats_th">' . _t('P_LEEDSTATS_NBART_LU') . '</th> <th class="leedStats_border leedStats_th">' . _t('P_LEEDSTATS_NBFAV') . '</th> '; while ($data = mysql_fetch_array($query)) { echo ' <tr> <td class="leedStats_border leedStats_textright">' . $data['nbFeed'] . '</td> <td class="leedStats_border leedStats_textright">' . $data['nbTotal'] . '</td> <td class="leedStats_border leedStats_textright">' . $data['nbUnread'] . '</td> <td class="leedStats_border leedStats_textright">' . $data['nbRead'] . '</td> <td class="leedStats_border leedStats_textright">' . $data['nbFavorite'] . '</td> </tr> '; } echo '</table> </div>'; } echo ' <h3>' . _t('P_LEEDSTATS_NBART_BY_FEED_TITLE') . '</h3> '; //Nombre global d'article lus / non lus / total / favoris $requete = 'SELECT name, count(1) as nbTotal, (SELECT count(1) FROM `' . MYSQL_PREFIX . 'event` le2 WHERE le2.unread=1 and le1.feed = le2.feed) as nbUnread, (SELECT count(1) FROM `' . MYSQL_PREFIX . 'event` le2 WHERE le2.unread=0 and le1.feed = le2.feed) as nbRead, (SELECT count(1) FROM `' . MYSQL_PREFIX . 'event` le2 WHERE le2.favorite=1 and le1.feed = le2.feed) as nbFavorite FROM `' . MYSQL_PREFIX . 'feed` lf1 INNER JOIN `' . MYSQL_PREFIX . 'event` le1 on le1.feed = lf1.id GROUP BY name ORDER BY name '; $query = mysql_query($requete); if ($query != null) { echo '<div id="result_leedStats1" class="result_leedStats1"> <table> <th class="leedStats_border leedStats_th">' . _t('P_LEEDSTATS_FEED') . '</th> <th class="leedStats_border leedStats_th">' . _t('P_LEEDSTATS_NBART') . '</th> <th class="leedStats_border leedStats_th">' . _t('P_LEEDSTATS_NBART_NONLU') . '</th> <th class="leedStats_border leedStats_th">' . _t('P_LEEDSTATS_NBART_LU') . '</th> <th class="leedStats_border leedStats_th">' . _t('P_LEEDSTATS_NBFAV') . '</th> '; while ($data = mysql_fetch_array($query)) { echo ' <tr> <td class="leedStats_border leedStats_textright">' . short_name($data['name'], 32) . '</td> <td class="leedStats_border leedStats_textright">' . $data['nbTotal'] . '</td> <td class="leedStats_border leedStats_textright">' . $data['nbUnread'] . '</td> <td class="leedStats_border leedStats_textright">' . $data['nbRead'] . '</td> <td class="leedStats_border leedStats_textright">' . $data['nbFavorite'] . '</td> </tr> '; } echo '</table> </div>'; } echo ' </section> </section> '; }
<?php if (!in_array($_GET['page'], $careerarray)) { ?> <div class="col_l"> <div style="padding-right: 7px; padding-left: 7px; padding-top: 10px; padding-bottom: 20px;"> <img src="images/news_feed.gif" /> <hr /> <br /> <?php if ($newsquery = mysql_query("SELECT * FROM news ORDER BY dateofpost DESC LIMIT 5")) { $newsnum = mysql_num_rows($newsquery); if ($newsnum > 0) { while ($newsdata = mysql_fetch_array($newsquery)) { $newscontent = stripslashes($newsdata['content']); $numchars = '100'; echo short_name($newscontent, $numchars); ?> <div align="right"> <a href="index.php?page=news/index.php#<?php echo stripslashes($newsdata['newsid']); ?> ">Read More</a> </div> <hr /> <br /> <?php } } else { ?> <p>Sorry, you have no news entries.</p> <?php
public function changes() { return with(App::make('Change'))->where('fmodel', short_name($this))->where('fid', $this->id)->with('user')->orderBy('created_at', 'DESC')->get(); }
$html .= "</ul>"; $html .= "<div class='publi-year'>" . $entry['year'] . " :</div>"; $html .= "<ul>"; $last_year = $entry['year']; } $html .= "<li>"; $html .= "<div>"; $html .= "<div class='publi-title'>" . clean_bibtex_string($entry['title']) . "</div>"; if (@$entry['author']) { $author = explode(' and ', $entry['author']); $author_str = ""; for ($i = 0; $i < count($author); $i++) { if ($i > 0) { $author_str .= ", "; } $author_str .= short_name($author[$i]); } $html .= "<div class='publi-author'>" . $author_str . "</div>"; } if (@$entry['booktitle']) { $html .= "<div class='publi-booktitle'>" . $entry['booktitle'] . "</div>"; } if (@$entry['journal']) { $html .= "<div class='publi-booktitle'>" . $entry['journal'] . "</div>"; } if (@$entry['keywords']) { $html .= "<div class='publi-keywords'>" . _("Keywords") . " : " . $entry['keywords'] . "</div>"; } if (@$entry['note']) { $html .= "<div class='publi-note'>" . $entry['note'] . "</div>"; }