本文整理汇总了PHP中Core类的典型用法代码示例。如果您正苦于以下问题:PHP Core类的具体用法?PHP Core怎么用?PHP Core使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Core类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct()
{
$this->__core = Core::getInstance();
$this->__lib = $this->__core->getLib();
$this->__uri = $this->__core->getUri();
$this->__req = $this->__core->getRequest();
}
示例2: getGoodsinfo
public function getGoodsinfo()
{
$goodsinfos = array();
$db = new Core();
$query = "SELECT g.*,\n gv.field as gvkey,\n gv.value as gvvalue,\n o.telphone as mobile,\n o.order_quantity as goods_number,\n o.goods_value as goods_value\n FROM " . DB_PREFIX . "goodslist g\n LEFT JOIN " . DB_PREFIX . "order o \n ON g.order_id=o.id\n LEFT JOIN " . DB_PREFIX . "goodsextensionvalue gv \n ON g.order_id=gv.id\n WHERE \n 1\n and o.order_id='" . $this->order_id . "'";
$mresult = $db->query($query);
if (!$mresult) {
$this->BundleGoods = $goodsinfos;
return;
}
foreach ($mresult as $result) {
$goods = json_decode(urldecode($result['extensions']), 1);
$goods['goods_number'] = $result['goods_number'];
$goods['goods_value'] = $result['goods_value'];
//$goods['mobile'] = $result['mobile'];
if ($result['gvkey'] == 'session') {
$goods['session'] = $result['gvvalue'];
}
$goodsinfos[$result['bundle_id']]['goods'][] = $goods;
}
//file_put_contents('./cache/mobile.txt',var_export($result,1));
$query = "SELECT *\n FROM " . DB_PREFIX . "order \n \n WHERE \n 1\n and order_id='" . $this->order_id . "'";
$re = $db->query($query, '');
$this->mobile = $re[0]['telphone'];
// = '18021806556';
$this->BundleGoods = $goodsinfos;
}
示例3: checkNeededDataGoogleSearchAnalytics
/**
* Query database. Retrun all values from a table
*
* @param $table String Table name
*
* @returns Object Database records. MySQL object
*/
public function checkNeededDataGoogleSearchAnalytics($website)
{
$core = new Core();
//Load core
$mysql = new MySQL();
//Load MySQL
$now = $core->now();
/* Identify date range */
$dateStartOffset = self::GOOGLE_SEARCH_ANALYTICS_MAX_DATE_OFFSET + self::GOOGLE_SEARCH_ANALYTICS_MAX_DAYS;
$dateStart = date('Y-m-d', strtotime('-' . $dateStartOffset . ' days', $now));
$dateEnd = date('Y-m-d', strtotime('-' . self::GOOGLE_SEARCH_ANALYTICS_MAX_DATE_OFFSET . ' days', $now));
/* Query database for dates with data */
$query = "SELECT COUNT( DISTINCT date ) AS record, date FROM " . MySQL::DB_TABLE_SEARCH_ANALYTICS . " WHERE domain LIKE '" . $website . "' AND date >= '" . $dateStart . "' AND date <= '" . $dateEnd . "' GROUP BY date";
$result = $mysql->query($query);
/* Create array from database response */
$datesWithData = array();
foreach ($result as $row) {
array_push($datesWithData, $row['date']);
}
/* Get date rante */
$dates = $core->getDateRangeArray($dateStart, $dateEnd);
/* Loop through dates, removing those with data */
foreach ($dates as $index => $date) {
if (in_array($date, $datesWithData)) {
unset($dates[$index]);
}
}
/* Reindex dates array */
$dates = array_values($dates);
$returnArray = array('dateStart' => $dateStart, 'dateEnd' => $dateEnd, 'datesWithNoData' => $dates);
return $returnArray;
}
示例4: getAppRoute
public function getAppRoute($route_name, $app_id = null)
{
if (!$this->mappingRepository) {
$this->mappingRepository = $this->doctrine->getManager()->getRepository('UnifikSystemBundle:Mapping');
}
$mapping = $this->mappingRepository->findOneBy(array('app' => $app_id ? $app_id : $this->systemCore->getApplicationCore()->getApp()->getId(), 'type' => 'route', 'target' => $route_name), array('section' => 'ASC'));
if ($mapping) {
// Faut checker toutes les routes, à cause du mapping alias
$routes = $this->router->getRouteCollection()->all();
foreach ($routes as $name => $route) {
if ($defaults = $route->getDefaults()) {
if (array_key_exists('_unifikRequest', $defaults) && array_key_exists('mappedRouteName', $defaults['_unifikRequest'])) {
$real_name = preg_replace('/^[aA-zZ]{2}__[A-Z]{2}__/', '', $defaults['_unifikRequest']['mappedRouteName']);
// On a trouvé la bonne route
if ($real_name == $route_name) {
return preg_replace('/^[aA-zZ]{2}__[A-Z]{2}__/', '', $name);
}
}
}
}
// On a rien trouvé... on retourne la route "par défaut" de la section
return 'section_id_' . $mapping->getSection()->getId();
}
// Aucun mapping... on fallback sur la premiere route disponible (?)
$mapping = $this->mappingRepository->findOneBy(array('type' => 'route', 'target' => $route_name), array('section' => 'ASC'));
if ($mapping) {
return 'section_id_' . $mapping->getSection()->getId();
}
// Rien de concluant
return null;
}
示例5: populatePPMTable
private function populatePPMTable($counter, $result_row)
{
$core = new Core();
$number_Of_houses = $core->getNumberofHouses($this->loc_table, $result_row['location']);
$this->total_num_of_houses += $number_Of_houses;
$per_street_year = $number_Of_houses * 12;
$this->total_expected += $per_street_year;
$date_done = $result_row['date_done'];
$done_till_date = $core->getTillDate($number_Of_houses, $date_done);
$this->expected_rate += $done_till_date;
$houses_serviced = $result_row['houses_serviced'];
$this->total_num_of_houses_serviced += $houses_serviced;
$status_tiil_date = $core->getStatusTillDate($number_Of_houses, $houses_serviced);
$current_satus = $core->getcurrentStatus($houses_serviced, $number_Of_houses, $status_tiil_date);
$calls_generated = $result_row['calls_gen'];
$this->total_calls_gen += $calls_generated;
$calls_completed = $result_row['calls_comp'];
$this->total_calls_gen += $calls_completed;
$no_access = $number_Of_houses - $houses_serviced;
$this->no_access_loc += $no_access;
$out = "";
$id = $result_row['S/N'];
$out .= " <tr>";
$out .= "<td >{$counter}</td>\n\t<td ondblclick='myFunction(this," . $id . ")' id='job_id'>" . $result_row['job_id'] . "</td>\n\t<td>" . $result_row['location'] . "</td><td>" . $number_Of_houses . "</td><td>Monthly</td>";
$out .= "<td>" . $per_street_year . "</td><td>" . $done_till_date . "</td>";
$out .= "<td ondblclick='myFunction(this," . $id . ")' id='houses_serviced'>" . $houses_serviced . "</td>";
$out .= "<td >" . $status_tiil_date . " % </td><td>" . $current_satus . " % </td>\n\t<td ondblclick='myFunction(this," . $id . ")' id='date_done'>" . $result_row['date_done'] . "</td>\n\t<td ondblclick='myFunction(this," . $id . ")' id='date_nect'>" . $result_row['date_next'] . "</td>";
$out .= "<td ondblclick='myFunction(this," . $id . ")' id='calls_gen'>{$calls_generated}</td>";
$out .= "<td ondblclick='myFunction(this," . $id . ")' id='calls_comp'>{$calls_completed}</td>\n\t<td ondblclick='myFunction(this," . $id . ")' id='inspection'>" . $result_row['inspection'] . "</td>\n\t<td ondblclick='myFunction(this," . $id . ")' id='noaccesslocresolved'>" . $result_row['noaccesslocresolved'] . "</td>";
$out .= "<td>" . $no_access . "</td><td ondblclick='myFunction(this," . $id . ")' id='engineers_remark'>" . $result_row['engineers_remark'] . "</td></tr>";
return $out;
}
示例6: initInvoice
private function initInvoice()
{
$core = new Core();
$this->invoiceNumber = $core->generatePreformerInvoiceNumber();
$this->jobNumber = $core->generateCmJobId();
$details = $core->getAllStockDetails($this->materials);
$this->stockRows .= '<tr class="item-row" id="item0">' . '<td>1</td>' . '<td class="item-name"><textarea data-role="none" class="item_name" >' . $details['part_number'] . '</textarea></td>' . '<td class="description"><textarea disabled data-role="none" class="item_description">' . $details['description'] . '</textarea></td>' . '<td><span disabled class="cost" data-role="none" id="unitCost1"><del>N</del>' . $details['price'] . '</span></td>' . '<td><textarea disabled class="qty" data-role="none" id="quantity1">1</textarea></td>' . '<td><span class="price" >0.00</span></td></tr>';
}
示例7: testExchangeArraySetsPropertiesToNullIfKeysAreNotPresent
public function testExchangeArraySetsPropertiesToNullIfKeysAreNotPresent()
{
$core = new Core();
$core->exchangeArray(array('name' => 'some name', 'id' => 123));
$core->exchangeArray(array());
$this->assertNull($core->name, '"name" should have defaulted to null');
$this->assertNull($core->id, '"id" should have defaulted to null');
}
示例8: updateSubscriberList
function updateSubscriberList($argArrPost)
{
$objCore = new Core();
$varID = implode('\',\'', $argArrPost['frmSubscriberID']);
$varWhere = "pkSubscriberID IN('" . $varID . "')";
$this->delete(TABLE_SUBSCRIBERS, $varWhere);
//***end here
$objCore->setSuccessMsg(ADMIN_SUBSCRIBER_DELETE);
return true;
}
示例9: printBeautifulPHPCode
function printBeautifulPHPCode($sourceCode)
{
require_once CODE_BEAUTIFIER_REQ;
require_once BEAUTIFIER_PATH . FILE_SEPARATOR . "HFile" . FILE_SEPARATOR . "HFile_php3.php";
require_once BEAUTIFIER_PATH . FILE_SEPARATOR . "Output" . FILE_SEPARATOR . "Output_HTML.php";
$highlighter = new Core(new HFile_php3(), new Output_HTML());
echo "<pre>";
echo $highlighter->highlight_text($sourceCode);
echo "</pre>";
}
示例10: imageUpload
function imageUpload($argFILES, $argVarDirLocation, $varThumbnailWidth = '', $varThumbnailHeight = '', $varMediumWidth = '', $varMediumHeight = '')
{
$objUpload = new upload();
$objCore = new Core();
$objUpload->setMaxSize();
$objUpload->setDirectory($argVarDirLocation);
$varIsImage = $objUpload->IsImageValid($argFILES['type']);
if ($varIsImage) {
$varImageExists = 'yes';
} else {
$varImageExists = 'no';
}
if ($varImageExists == 'no') {
$objCore->setErrorMsg(IMAGE_TYPE_ERROR);
return false;
}
if ($varImageExists == 'yes') {
$objUpload->setTmpName($argFILES['tmp_name']);
if ($objUpload->userTmpName) {
$objUpload->setFileSize($argFILES['size']);
$objUpload->setFileType($argFILES['type']);
$varRandomNumber = $this->generateRandomKey();
$fileName = $varRandomNumber . '_' . strtolower($argFILES['name']);
$fileName = str_replace(' ', '_', $fileName);
$objUpload->setFileName($fileName);
$objUpload->startCopy();
if ($objUpload->isError()) {
$thumbnailName1 = '_thumb';
$objUpload->setThumbnailName($thumbnailName1);
$objUpload->createThumbnail();
if ($varThumbnailWidth == '' && $varThumbnailHeight == '') {
$objUpload->setThumbnailSize();
} else {
$objUpload->setThumbnailSize($varThumbnailWidth, $varThumbnailHeight);
}
$varFileName = $objUpload->userFileName;
$varExt = substr(strrchr($varFileName, "."), 1);
$varThumbFileNameNoExt = substr($varFileName, 0, -(strlen($varExt) + 1));
$varThumbFileName = $varThumbFileNameNoExt . 'thumb.' . $varExt;
$thumbnailName1 = '';
$objUpload->setThumbnailName($thumbnailName1);
$objUpload->createThumbnail();
if ($varMediumWidth == '' && $varMediumHeight == '') {
$objUpload->setThumbnailSize();
} else {
$objUpload->setThumbnailSize($varMediumWidth, $varMediumHeight);
}
return $varFileName;
} else {
$objCore->setErrorMsg(ERROR_ON_UPLOAD);
return false;
}
}
}
}
示例11: overdueproceess
public function overdueproceess()
{
$time = 2100;
//过期时间
$db = new Core();
/**
* 查询与订单号相关的商品,订单中相关信息如积分等
*/
$query = "SELECT \n \t g.*,\n \t o.order_id as new_order_id,\n \t o.pay_credits as pay_credits,\n \t o.user_id as user_id,\n \t\t o.integral_status as integral_status\n \t FROM " . DB_PREFIX . "goodslist g\n LEFT JOIN " . DB_PREFIX . "order o\n ON g.order_id=o.id\n WHERE o.pay_status = 1 \n and o.create_time<" . (time() - $time) . " limit 0,100";
$goodses = $db->query($query);
if (!$goodses) {
return;
}
$ids = array();
$newgoodses = array();
foreach ($goodses as $goods) {
$newgoodses[$goods['bundle_id']]['goods'][$goods['goods_id']]['id'] = $goods['goods_id'];
$newgoodses[$goods['bundle_id']]['goods'][$goods['goods_id']]['goods_number'] += $goods['goods_number'];
$newgoodses[$goods['bundle_id']]['goods'][$goods['goods_id']]['bundle_id'] = $goods['bundle_id'];
$ids[] = $goods['order_id'];
$credits[$goods['user_id']]['id'] = $goods['order_id'];
$credits[$goods['user_id']]['order_id'] = $goods['new_order_id'];
$credits[$goods['user_id']]['credit'] = $goods['pay_credits'];
$credits[$goods['user_id']]['integral_status'] = $goods['integral_status'];
//积分的状态
}
$this->BundleGoods = $newgoodses;
foreach ($newgoodses as $bundle_id => $bundlegoodses) {
$curl = $bundle_id . "curl";
$this->{$curl} = $this->create_curl_obj($bundle_id);
$this->init_curl($bundle_id);
//$Re_Minus_updateStores = $this -> opBundle('updateStore', array('operation' => 'plus'));
}
$Re_Minus_updateStores = $this->opBundle('updateStore', array('operation' => 'plus'));
$orderids = implode(",", $ids);
if (!$orderids) {
return false;
}
require_once CUR_CONF_PATH . 'lib/sms.class.php';
require_once ROOT_PATH . 'lib/class/members.class.php';
$members = new members();
foreach ($credits as $user => $v) {
if (!$v['credit']) {
continue;
}
$re = $members->return_credit($user, $v['credit'], $v['order_id'], 'payments', 'OrderUpdate', 'cancle', '订单:' . $v['order_id'] . '被系统取消:' . $v['title'], $v['integral_status'], '取消订单');
if (!$re['logid']) {
return false;
}
}
$query = "UPDATE " . DB_PREFIX . "order \n SET order_status=24,pay_status=3,is_completed=23\n WHERE pay_status=1 and id in(" . $orderids . ")";
$result = $db->query_update($query);
}
示例12: saveClientExtras
function saveClientExtras($argArrPost)
{
$objCore = new Core();
$clientExtra1 = $argArrPost['ClientExtra1'];
$clientExtra2 = $argArrPost['ClientExtra2'];
if ($argArrPost['client_id'] != '') {
$varWhere = 'pkClientID = ' . $argArrPost['client_id'];
$arrclm = array('ClientExtra1' => $clientExtra1, 'ClientExtra2' => $clientExtra2);
$varExtraID = $this->update(TABLE_CLIENTS, $arrclm, $varWhere);
$objCore->setSuccessMsg("Extra settings updated successfully");
return 2;
}
}
示例13: render
public function render($output)
{
$Core = new Core();
$this->dir = $_SERVER['DOCUMENT_ROOT'] . DS . $Core->path;
//print_r($this->values);
if (isset($this->values['layout'])) {
$this->layout = $this->values['layout'];
}
$base_url = $Core->site($this->layout);
$site_url = $Core->site_url();
$title = isset($this->values['title']) ? $this->values['title'] : $this->title;
$header = isset($this->values['header']) ? $this->values['header'] : $this->header;
$content = $output;
include $this->dir . DS . 'Layout' . DS . $this->layout . DS . 'default.phtml';
}
示例14: execute
/**
* Add the comment.
*/
function execute()
{
// Personalized execute() method since now there are possibly two comments contained within each form submission.
$commentDao = DAORegistry::getDAO('PaperCommentDAO');
$this->insertedComments = array();
// Assign all common information
$comment = new PaperComment();
$comment->setCommentType($this->commentType);
$comment->setRoleId($this->roleId);
$comment->setPaperId($this->paper->getPaperId());
$comment->setAssocId($this->assocId);
$comment->setAuthorId($this->user->getId());
$comment->setCommentTitle($this->getData('commentTitle'));
$comment->setDatePosted(Core::getCurrentDate());
// If comments "For authors and director" submitted
if ($this->getData('authorComments') != null) {
$comment->setComments($this->getData('authorComments'));
$comment->setViewable(1);
array_push($this->insertedComments, $commentDao->insertPaperComment($comment));
}
// If comments "For director" submitted
if ($this->getData('comments') != null) {
$comment->setComments($this->getData('comments'));
$comment->setViewable(null);
array_push($this->insertedComments, $commentDao->insertPaperComment($comment));
}
}
示例15: submission
/**
* View an assigned submission's layout editing page.
* @param $args array ($articleId)
*/
function submission($args)
{
$articleId = isset($args[0]) ? $args[0] : 0;
list($journal, $submission) = SubmissionLayoutHandler::validate($articleId);
parent::setupTemplate(true, $articleId);
import('submission.proofreader.ProofreaderAction');
ProofreaderAction::layoutEditorProofreadingUnderway($submission);
$layoutAssignment =& $submission->getLayoutAssignment();
if ($layoutAssignment->getDateNotified() != null && $layoutAssignment->getDateUnderway() == null) {
// Set underway date
$layoutAssignment->setDateUnderway(Core::getCurrentDate());
$layoutDao =& DAORegistry::getDAO('LayoutEditorSubmissionDAO');
$layoutDao->updateSubmission($submission);
}
$disableEdit = !SubmissionLayoutHandler::layoutEditingEnabled($submission);
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign_by_ref('submission', $submission);
$templateMgr->assign('disableEdit', $disableEdit);
$templateMgr->assign('useProofreaders', $journal->getSetting('useProofreaders'));
$templateMgr->assign('templates', $journal->getSetting('templates'));
$templateMgr->assign('helpTopicId', 'editorial.layoutEditorsRole.layout');
$publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
$publishedArticle =& $publishedArticleDao->getPublishedArticleByArticleId($submission->getArticleId());
if ($publishedArticle) {
$issueDao =& DAORegistry::getDAO('IssueDAO');
$issue =& $issueDao->getIssueById($publishedArticle->getIssueId());
$templateMgr->assign_by_ref('publishedArticle', $publishedArticle);
$templateMgr->assign_by_ref('issue', $issue);
}
$templateMgr->display('layoutEditor/submission.tpl');
}