本文整理汇总了PHP中School类的典型用法代码示例。如果您正苦于以下问题:PHP School类的具体用法?PHP School怎么用?PHP School使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了School类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: _edit
function _edit($OID = 0, $CID = 0)
{
loginRequireMgmt();
if (!loginCheckPermission(USER::MGMT_SCHOOL)) {
redirect("errors/401");
}
$item = "School";
$urlPrefix = "mgmt_school";
$object = new School();
$object->retrieve($OID, $CID);
if (!$object->exists()) {
$data['body'][] = "<p>{$item} Not Found!</p>";
} else {
$fdata['form_heading'] = "Edit {$item}";
$fdata['object'] = $object;
$fdata['actionUrl'] = myUrl("{$urlPrefix}/ops_update");
$fdata['actionLabel'] = "Submit";
$fdata['cancelUrl'] = myUrl("{$urlPrefix}/manage");
$fdata['cancelLabel'] = "Cancel";
$form = View::do_fetch(VIEW_PATH . "{$urlPrefix}/form.php", $fdata);
$data['head'][] = View::do_fetch(VIEW_PATH . "{$urlPrefix}/form_js.php");
$data['body'][] = "<h2>Edit {$item}</h2>";
$data['body'][] = $form;
}
View::do_dump(VIEW_PATH . 'layouts/mgmtlayout.php', $data);
}
开发者ID:brata-hsdc,项目名称:brata.masterserver,代码行数:26,代码来源:edit.php
示例2: getAvailableSchoolsAttribute
public function getAvailableSchoolsAttribute()
{
$filters = array_filter(Input::only('specialty', 'district', 'municipality', 'city', 'type', 'search'));
$filters['financing'][] = $this->id;
$schools_data = new School();
return $schools_data->filterSchools($filters)->get()->count();
}
开发者ID:mertindervish,项目名称:registerbg,代码行数:7,代码来源:Financing.php
示例3: _ops_delete
function _ops_delete($OID = 0, $CID = 0)
{
$OID = max(0, intval($OID));
$CID = max(0, intval($CID));
$msg = '';
loginRequireMgmt();
if (!loginCheckPermission(USER::MGMT_SCHOOL)) {
redirect("errors/401");
}
$itemName = "School";
$urlPrefix = "mgmt_school";
$object = new School($OID, $CID);
if (!$object->exists()) {
$msg = "{$itemName} not found!";
} else {
transactionBegin();
if ($object->delete()) {
transactionCommit();
$msg = "{$itemName} deleted!";
} else {
TransactionRollback();
$msg = "{$itemName} delete failed!";
}
}
redirect("{$urlPrefix}/manage", $msg);
}
开发者ID:brata-hsdc,项目名称:brata.masterserver,代码行数:26,代码来源:ops_delete.php
示例4: isexist
function isexist($zipcode)
{
$Model_B = new School();
$valid = $Model_B->find('count', array('conditions' => array('School.school_code' => $zipcode)));
if ($valid == 1) {
return true;
} else {
return false;
}
}
开发者ID:Betasoft111,项目名称:notifywebapp,代码行数:10,代码来源:Teacher.php
示例5: getAllAsHTMLOptions
static function getAllAsHTMLOptions($itemId = -1)
{
$school = new School();
$aray = $school->retrieve_many();
$options = "";
foreach ($aray as $item) {
$itemOID = $item->get('OID');
$selected = $item->rs['OID'] == $itemId ? "selected" : "";
$options .= '<option value=' . $itemOID . ' ' . $selected . '>' . $item->get("name");
}
return $options;
}
开发者ID:brata-hsdc,项目名称:brata.masterserver,代码行数:12,代码来源:School.php
示例6: ajaxResponse
public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
{
//icons
$copyIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/copy.png";
$cutIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/cut.png";
$referIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/refer.png";
$trashIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/trash.png";
$hideIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/hide.png";
$bookmarkIcon = \Bookmarks::getInstance()->getAssetUrl() . "icons/bookmark.png";
$schoolBookmarkIcon = \School::getInstance()->getAssetUrl() . "icons/schoolbookmark.png";
$upIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/up.png";
$downIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/down.png";
$topIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/top.png";
$bottomIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/bottom.png";
$renameIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/rename.png";
$editIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/edit.png";
$propertiesIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/properties.png";
$rightsIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/rights.png";
$blankIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/blank.png";
// <img src=\"{$editIcon}\">
$popupMenu = new \Widgets\PopupMenu();
$items = array(array("name" => "Bearbeiten <img src=\"{$editIcon}\">", "command" => "EditTopic", "namespace" => "PortletTopic", "params" => "{'portletId':'{$this->id}'}", "type" => "popup"), array("name" => "Kategorie einfügen <img src=\"{$blankIcon}\">", "command" => "CreateCategory", "namespace" => "PortletTopic", "params" => "{'portletId':'{$this->id}'}", "type" => "popup"), array("name" => "Umsortieren <img src=\"{$blankIcon}\">", "direction" => "left", "menu" => array(array("name" => "Eins nach oben <img src=\"{$upIcon}\">", "command" => "Order", "namespace" => "Portal", "params" => "{'portletId':'{$this->id}','order':'up'}", "type" => "popup"), array("name" => "Eins nach unten <img src=\"{$downIcon}\">", "command" => "Order", "namespace" => "Portal", "params" => "{'portletId':'{$this->id}','order':'down'}", "type" => "popup"), array("name" => "Ganz nach oben <img src=\"{$topIcon}\">", "command" => "Order", "namespace" => "Portal", "params" => "{'portletId':'{$this->id}','order':'first'}", "type" => "popup"), array("name" => "Ganz nach unten <img src=\"{$bottomIcon}\">", "command" => "Order", "namespace" => "Portal", "params" => "{'portletId':'{$this->id}','order':'last'}", "type" => "popup"))), array("name" => "SEPARATOR"), array("name" => "Kopieren <img src=\"{$copyIcon}\">", "command" => "PortletCopy", "namespace" => "Portal", "params" => "{'id':'{$this->id}','user':'{$this->user}'}", "type" => "popup"), array("name" => "Ausschneiden <img src=\"{$cutIcon}\">", "command" => "PortletCut", "namespace" => "Portal", "params" => "{'id':'{$this->id}','user':'{$this->user}'}", "type" => "popup"), array("name" => "Referenzieren <img src=\"{$referIcon}\">", "command" => "PortletReference", "namespace" => "Portal", "params" => "{'id':'{$this->id}','user':'{$this->user}'}", "type" => "popup"), array("name" => "Löschen <img src=\"{$trashIcon}\">", "command" => "Delete", "namespace" => "PortletTopic", "params" => "{'portletId':'{$this->id}'}", "type" => "popup"), array("name" => "SEPARATOR"), array("name" => "Rechte <img src=\"{$rightsIcon}\">", "command" => "Sanctions", "namespace" => "Explorer", "params" => "{'id':'{$this->id}'}", "type" => "popup"));
$popupMenu->setItems($items);
$popupMenu->setPosition(round($this->x + $this->width - 155) . "px", round($this->y + $this->height + 4) . "px");
$popupMenu->setWidth("150px");
$ajaxResponseObject->setStatus("ok");
$ajaxResponseObject->addWidget($popupMenu);
return $ajaxResponseObject;
}
开发者ID:rolwi,项目名称:koala,代码行数:29,代码来源:GetPopupMenu.class.php
示例7: ajaxResponse
public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
{
//icons
$copyIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/copy.png";
$cutIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/cut.png";
$referIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/refer.png";
$deleteIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/delete.png";
$hideIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/hide.png";
$bookmarkIcon = \Bookmarks::getInstance()->getAssetUrl() . "icons/bookmark.png";
$schoolBookmarkIcon = \School::getInstance()->getAssetUrl() . "icons/schoolbookmark.png";
$upIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/up.png";
$downIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/down.png";
$topIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/top.png";
$bottomIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/bottom.png";
$renameIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/rename.png";
$editIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/edit.png";
$propertiesIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/properties.png";
$rightsIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/rights.png";
$blankIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/blank.png";
$popupMenu = new \Widgets\PopupMenu();
$items = array(array("name" => "Bearbeiten <img src=\"{$editIcon}\">", "command" => "EditTerm", "namespace" => "PortletAppointment", "params" => "{'portletId':'{$this->id}','termIndex':'{$this->termIndex}'}", "type" => "popup"), array("name" => "Löschen <img src=\"{$deleteIcon}\">", "command" => "DeleteTerm", "namespace" => "PortletAppointment", "params" => "{'portletId':'{$this->id}','termIndex':'{$this->termIndex}'}", "type" => "popup"));
$popupMenu->setItems($items);
$popupMenu->setPosition(round($this->x + $this->width - 155) . "px", round($this->y + $this->height + 4) . "px");
$popupMenu->setWidth("150px");
$ajaxResponseObject->setStatus("ok");
$ajaxResponseObject->addWidget($popupMenu);
return $ajaxResponseObject;
}
开发者ID:rolwi,项目名称:koala,代码行数:28,代码来源:GetPopupMenuTerm.class.php
示例8: actionEditmoreinfo
public function actionEditmoreinfo($user_id)
{
$user_more_info = UserInfoAR::model()->findByPk($user_id);
$this->assign('user_more', $user_more_info);
$maritalStatus = MaritalStatus::model()->findAll();
// 'MaritalStatus', 'marital_status_id'),
$hometown = Hometown::model()->findAll();
// 'Province', 'hometown_id'),
$nation = Nation::model()->findAll();
// 'Nation', 'nation_id'),
$bodyType = BodyType::model()->findAll();
// 'BodyType', 'body_type_id'),
$education = Education::model()->findAll();
// 'Education', 'education_id'),
$school = School::model()->findAll();
// 'School', 'school_id'),
$province = Province::model()->findAll();
// 'Province', 'province_id'),
$job = Job::model()->findAll();
// '$maritalSta,
$this->assign('maritalStatus', $maritalStatus);
$this->assign('hometown', $hometown);
$this->assign('nation', $nation);
$this->assign('bodyType', $bodyType);
$this->assign('education', $education);
$this->assign('school', $school);
$this->assign('province', $province);
$this->assign('job', $job);
}
开发者ID:sheepcat,项目名称:piebridge,代码行数:29,代码来源:PersonController.php
示例9: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$statistics = (object) array('schools_count' => School::all()->count(), 'municipalities_count' => Municipality::all()->count(), 'visitor_likes_count' => VisitorLikes::all()->count(), 'visitor_comments_count' => VisitorComments::all()->count());
$home_schools = School::orderBy('created_at', 'desc')->take(5)->get();
$home_comments = VisitorComments::orderBy('created_at', 'desc')->take(5)->get();
return View::make('admin.home')->with('home_schools', $home_schools)->with('home_comments', $home_comments)->with('statistics', $statistics);
}
开发者ID:mertindervish,项目名称:registerbg,代码行数:12,代码来源:AdminHomeController.php
示例10: ajaxResponse
public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
{
//icons
$copyIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/copy.png";
$cutIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/cut.png";
$referIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/refer.png";
$deleteIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/delete.png";
$hideIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/hide.png";
$bookmarkIcon = \Bookmarks::getInstance()->getAssetUrl() . "icons/bookmark.png";
$schoolBookmarkIcon = \School::getInstance()->getAssetUrl() . "icons/schoolbookmark.png";
$upIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/up.png";
$downIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/down.png";
$topIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/top.png";
$bottomIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/bottom.png";
$renameIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/rename.png";
$editIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/edit.png";
$propertiesIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/properties.png";
$rightsIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/rights.png";
$blankIcon = \Explorer::getInstance()->getAssetUrl() . "icons/menu/blank.png";
$popupMenu = new \Widgets\PopupMenu();
$items = array(array("name" => "Bearbeiten <img src=\"{$editIcon}\">", "command" => "EditMessage", "namespace" => "PortletMsg", "params" => "{'portletObjectId':'{$this->portletObjectId}','messageObjectId':'{$this->messageObjectId}'}", "type" => "popup"), array("name" => "Bild bearbeiten <img src=\"{$blankIcon}\">", "command" => "EditMessageImage", "namespace" => "PortletMsg", "params" => "{'portletObjectId':'{$this->portletObjectId}','messageObjectId':'{$this->messageObjectId}'}", "type" => "popup"), array("name" => "Umsortieren <img src=\"{$blankIcon}\">", "direction" => "left", "menu" => array(array("name" => "Eins nach oben <img src=\"{$upIcon}\">", "command" => "OrderMessage", "namespace" => "PortletMsg", "params" => "{'portletObjectId':'{$this->portletObjectId}','messageObjectId':'{$this->messageObjectId}','order':'up'}", "type" => "popup"), array("name" => "Eins nach unten <img src=\"{$downIcon}\">", "command" => "OrderMessage", "namespace" => "PortletMsg", "params" => "{'portletObjectId':'{$this->portletObjectId}','messageObjectId':'{$this->messageObjectId}','order':'down'}", "type" => "popup"), array("name" => "Ganz nach oben <img src=\"{$topIcon}\">", "command" => "OrderMessage", "namespace" => "PortletMsg", "params" => "{'portletObjectId':'{$this->portletObjectId}','messageObjectId':'{$this->messageObjectId}','order':'first'}", "type" => "popup"), array("name" => "Ganz nach unten <img src=\"{$bottomIcon}\">", "command" => "OrderMessage", "namespace" => "PortletMsg", "params" => "{'portletObjectId':'{$this->portletObjectId}','messageObjectId':'{$this->messageObjectId}','order':'last'}", "type" => "popup"))), array("name" => "Löschen <img src=\"{$deleteIcon}\">", "command" => "DeleteMessage", "namespace" => "PortletMsg", "params" => "{'portletObjectId':'{$this->portletObjectId}','messageObjectId':'{$this->messageObjectId}'}", "type" => "popup"));
$popupMenu->setItems($items);
$popupMenu->setPosition(round($this->x + $this->width - 155) . "px", round($this->y + $this->height + 4) . "px");
$popupMenu->setWidth("150px");
$ajaxResponseObject->setStatus("ok");
$ajaxResponseObject->addWidget($popupMenu);
return $ajaxResponseObject;
}
开发者ID:rolwi,项目名称:koala,代码行数:28,代码来源:GetPopupMenuMessage.class.php
示例11: run
public function run()
{
$faker = Faker::create();
foreach (range(1, 10) as $index) {
School::create([]);
}
}
开发者ID:inseo201,项目名称:atletik4,代码行数:7,代码来源:SchoolsTableSeeder.php
示例12: _make_html_table
function _make_html_table($table, $item, $urlPrefix, $n, &$data)
{
$dbh = getdbh();
//pagination
$stmt = $dbh->query("SELECT count(OID) total FROM {$table}");
$total = $stmt->fetchColumn();
$limit = $GLOBALS['pagination']['per_page'];
$data['body'][] = '<p>Showing records ' . ($n + 1) . ' to ' . min($total, $n + $limit) . ' of ' . $total . '</p>';
$data['body'][] = pagination::makePagination($n, $total, myUrl("{$urlPrefix}/manage"), $GLOBALS['pagination']);
//table
$stmt = $dbh->query("SELECT OID,CID,name,pin,schoolId FROM {$table} LIMIT {$n},{$limit}");
if ($stmt === false) {
var_dump($dbh->errorInfo());
return;
}
$tablearr[] = explode(',', "name,pin,school");
while ($rs = $stmt->fetch(PDO::FETCH_ASSOC)) {
$OID = $rs['OID'];
$CID = $rs['CID'];
$row = null;
foreach ($tablearr[0] as $f) {
if ($f == 'school') {
$row[] = htmlspecialchars(School::getNameFromId($rs['schoolId']));
} else {
$row[] = htmlspecialchars($rs[$f]);
}
}
$row[] = '<a href="' . myUrl("{$urlPrefix}/edit_score/{$OID}/{$CID}") . '">Edit Score</a> | ' . '<a href="' . myUrl("{$urlPrefix}/edit/{$OID}/{$CID}") . '">Edit</a> | ' . '<a href="javascript:jsconfirm(\'Really Delete ' . $item . '?\',\'' . myUrl("{$urlPrefix}/ops_delete/{$OID}/{$CID}") . '\')">Delete</a>';
$tablearr[] = $row;
}
$data['body'][] = table::makeTable($tablearr);
$data['head'][] = '<script type="text/javascript" src="' . myUrl('js/jsconfirm.js') . '"></script>';
}
开发者ID:brata-hsdc,项目名称:brata.masterserver,代码行数:33,代码来源:manage.php
示例13: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
// create new sitemap object
$sitemap = App::make("sitemap");
// set cache (key (string), duration in minutes (Carbon|Datetime|int), turn on/off (boolean))
// by default cache is disabled
$sitemap->setCache('laravel.sitemap', 3600);
// check if there is cached sitemap and build new only if is not
if (!$sitemap->isCached()) {
// add item to the sitemap (url, date, priority, freq)
$sitemap->add(URL::route('index'), '2015-04-18T12:24:11+00:00', '1.0', 'daily');
// get all posts from db
$schools = School::all();
// add every post to the sitemap
foreach ($schools as $school) {
$images = array(array('url' => $school->cover_photo_url, 'title' => $school->name, 'caption' => $school->name));
foreach ($school->photos_data as $image) {
$images[] = array('url' => $image->photo_url, 'title' => $school->name, 'caption' => $image->name);
}
$sitemap->add($school->school_url, $school->updated_at, '0.9', 'daily', $images);
}
}
// show your sitemap (options: 'xml' (default), 'html', 'txt', 'ror-rss', 'ror-rdf')
return $sitemap->render('xml');
}
开发者ID:mertindervish,项目名称:registerbg,代码行数:30,代码来源:SitemapController.php
示例14: run
public function run()
{
$faker = Faker\Factory::create();
for ($id = 1; $id < 19; $id++) {
School::create(['user_id' => $id, 'primary_name' => $faker->randomElement(['Jose Rizal University', 'Rizal Techonological University', 'La Salle', 'Ateneo de Manila', 'San Sebastian College', 'University of the Philippines', 'University of Santo Tomas']), 'primary_address' => $faker->streetAddress, 'primary_years' => '', 'secondary_name' => $faker->randomElement(['Jose Rizal University', 'Rizal Techonological University', 'La Salle', 'Ateneo de Manila', 'San Sebastian College', 'University of the Philippines', 'University of Santo Tomas']), 'secondary_address' => $faker->streetAddress, 'secondary_years' => '', 'tertiary_name' => $faker->randomElement(['Jose Rizal University', 'Rizal Techonological University', 'La Salle', 'Ateneo de Manila', 'San Sebastian College', 'University of the Philippines', 'University of Santo Tomas']), 'tertiary_address' => $faker->streetAddress, 'tertiary_years' => '']);
}
}
开发者ID:codeblues1516,项目名称:godaddy,代码行数:7,代码来源:SchoolTableSeeder.php
示例15: getMyprofile
public function getMyprofile()
{
$id = Auth::user()->id;
$alumni_id = null;
$sql = "SELECT * FROM alumni WHERE account_id = ?";
$prof = DB::select($sql, array($id));
if ($prof != null) {
$alumni_id = $prof[0]->id;
}
$sql2 = "SELECT * FROM degree WHERE alumni_id = ?";
$deg = DB::select($sql2, array($alumni_id));
$sql3 = "SELECT * FROM work_experience WHERE alumni_id = ?";
$wrk_exp = DB::select($sql3, array($alumni_id));
$sql4 = "SELECT * FROM certificate WHERE alumni_id = ?";
$certificate = DB::select($sql4, array($alumni_id));
// $sql5 = "SELECT * FROM alumni_tracer WHERE alumni_id = ?";
$sql5 = "SELECT at.*, sq.question, sc.choice\n\t\t\t\tFROM alumni_tracer AS at\n\t\t\t\tINNER JOIN survey_questions AS sq\n\t\t\t\tON sq.id = at.question_id\n\t\t\t\tINNER JOIN survey_choices AS sc\n\t\t\t\tON sc.id = at.choice_id\n\t\t\t\tWHERE at.alumni_id = ?\n\t\t\t\tORDER BY at.question_id";
$a_tracer = DB::select($sql5, array($alumni_id));
$dept = Department::all();
$region = Region::all();
$province = Province::all();
$occupation = Occupation::all();
$company = Company::all();
$deg_title = DegreeTitle::all();
$school = School::all();
$jobs = Job::all();
$field = Field::all();
$questions = DB::select("SELECT * FROM survey_questions");
$civil_status = DB::select("SELECT * FROM civil_status");
return View::make('user.profile')->with('company', $company)->with('field', $field)->with('occupation', $occupation)->with('work_exp', $wrk_exp)->with('degree', $deg)->with('a_tracer', $a_tracer)->with('certificate', $certificate)->with('school', $school)->with('deg_title', $deg_title)->with('profile', $prof)->with('dept', $dept)->with('region', $region)->with('province', $province)->with('civil_status', $civil_status)->with('questions', $questions)->with('jobs', $jobs);
}
开发者ID:patocjurel,项目名称:capstone-project,代码行数:31,代码来源:UserController.php
示例16: __construct
public function __construct($studentId, $identityId, $gradeId, $schoolId)
{
$this->studentId = $studentId;
$this->identity = Identity::findById($identityId);
$this->school = School::findById($schoolId);
$this->grade = Grade::findById($gradeId);
}
开发者ID:MatthewAry,项目名称:php-cs313,代码行数:7,代码来源:student.php
示例17: ajaxResponse
public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
{
$count = count($this->selection);
$explorerAssetUrl = \Explorer::getInstance()->getAssetUrl();
if (!in_array($this->id, $this->selection) || in_array($this->id, $this->selection) && $count == 1) {
$object = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id);
$env = $object->get_environment();
$inventory = $env->get_inventory();
foreach ($inventory as $key => $element) {
if ($element->get_id() == $this->id) {
$index = $key;
}
}
$popupMenu = new \Widgets\PopupMenu();
if ($object instanceof \steam_trashbin) {
$items = array(array("name" => "Papierkorb leeren", "command" => "EmptyTrashbin", "namespace" => "explorer", "params" => "{'id':'{$this->id}'}"));
} else {
if ($env instanceof \steam_trashbin) {
$items = array(array("raw" => "<a href=\"#\" onclick=\"sendMultiRequest('EmptyTrashbin', getParamsArray({}), getElementIdArray(''), 'updater', null, null, 'explorer', 'Lösche Objekte ...', 0, getSelectionAsArray().length); return false;\">{$count} Objekte löschen<img src=\"\"></a>"), array("raw" => "<a href=\"#\" onclick=\"sendMultiRequest('Delete', getParamsArray({}), getElementIdArray(''), 'updater', null, null, 'explorer', 'Lösche Objekte ...', 0, getSelectionAsArray().length); return false;\">{$count} Objekte wiederherstellen<img src=\"\"></a>"));
} else {
$copyIcon = $explorerAssetUrl . "icons/menu/copy.png";
$cutIcon = $explorerAssetUrl . "icons/menu/cut.png";
$referIcon = $explorerAssetUrl . "icons/menu/refer.png";
$trashIcon = $explorerAssetUrl . "icons/menu/trash.png";
$hideIcon = $explorerAssetUrl . "icons/menu/hide.png";
$bookmarkIcon = \Bookmarks::getInstance()->getAssetUrl() . "icons/bookmark.png";
$schoolBookmarkIcon = \School::getInstance()->getAssetUrl() . "icons/schoolbookmark.png";
$upIcon = $explorerAssetUrl . "icons/menu/up.png";
$downIcon = $explorerAssetUrl . "icons/menu/down.png";
$topIcon = $explorerAssetUrl . "icons/menu/top.png";
$bottomIcon = $explorerAssetUrl . "icons/menu/bottom.png";
$renameIcon = $explorerAssetUrl . "icons/menu/rename.png";
$editIcon = $explorerAssetUrl . "icons/menu/edit.png";
$propertiesIcon = $explorerAssetUrl . "icons/menu/properties.png";
$rightsIcon = $explorerAssetUrl . "icons/menu/rights.png";
$blankIcon = $explorerAssetUrl . "icons/menu/blank.png";
$items = array(array("name" => "Kopieren<img src=\"{$copyIcon}\">", "command" => "Copy", "namespace" => "explorer", "params" => "{'id':'{$this->id}'}"), array("name" => "Ausschneiden<img src=\"{$cutIcon}\">", "command" => "Cut", "namespace" => "explorer", "params" => "{'id':'{$this->id}'}"), array("name" => "Referenzieren<img src=\"{$referIcon}\">", "command" => "Reference", "namespace" => "explorer", "params" => "{'id':'{$this->id}'}"), array("name" => "Löschen<img src=\"{$trashIcon}\">", "command" => "Delete", "namespace" => "explorer", "params" => "{'id':'{$this->id}'}"), array("name" => "Darstellung<img src=\"{$blankIcon}\">", "direction" => "left", "menu" => array(array("raw" => " <a href=\"#\" onclick=\"sendRequest('ChangeColorLabel', {'id':'{$this->id}', 'color':'transparent'}, 'listviewer-overlay', 'updater', null, null, 'explorer'); return false;\"><img src=\"{$explorerAssetUrl}icons/transparent.png\"></a>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t <a href=\"#\" onclick=\"sendRequest('ChangeColorLabel', {'id':'{$this->id}', 'color':'red'}, 'listviewer-overlay', 'updater', null, null, 'explorer'); return false;\"><img src=\"{$explorerAssetUrl}icons/red.png\"></a>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t <a href=\"#\" onclick=\"sendRequest('ChangeColorLabel', {'id':'{$this->id}', 'color':'orange'}, 'listviewer-overlay', 'updater', null, null, 'explorer'); return false;\"><img src=\"{$explorerAssetUrl}icons/orange.png\"></a>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t <a href=\"#\" onclick=\"sendRequest('ChangeColorLabel', {'id':'{$this->id}', 'color':'yellow'}, 'listviewer-overlay', 'updater', null, null, 'explorer'); return false;\"><img src=\"{$explorerAssetUrl}icons/yellow.png\"></a>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t <a href=\"#\" onclick=\"sendRequest('ChangeColorLabel', {'id':'{$this->id}', 'color':'green'}, 'listviewer-overlay', 'updater', null, null, 'explorer'); return false;\"><img src=\"{$explorerAssetUrl}icons/green.png\"></a>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t <a href=\"#\" onclick=\"sendRequest('ChangeColorLabel', {'id':'{$this->id}', 'color':'blue'}, 'listviewer-overlay', 'updater', null, null, 'explorer'); return false;\"><img src=\"{$explorerAssetUrl}icons/blue.png\"></a>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t <a href=\"#\" onclick=\"sendRequest('ChangeColorLabel', {'id':'{$this->id}', 'color':'purple'}, 'listviewer-overlay', 'updater', null, null, 'explorer'); return false;\"><img src=\"{$explorerAssetUrl}icons/purple.png\"></a>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t <a href=\"#\" onclick=\"sendRequest('ChangeColorLabel', {'id':'{$this->id}', 'color':'grey'}, 'listviewer-overlay', 'updater', null, null, 'explorer'); return false;\"><img src=\"{$explorerAssetUrl}icons/grey.png\"></a>"))), array("name" => "Umsortieren<img src=\"{$blankIcon}\">", "direction" => "left", "menu" => array($index != 0 ? array("name" => "Eins nach oben<img src=\"{$upIcon}\">", "command" => "Order", "namespace" => "explorer", "params" => "{'id':'{$this->id}', 'direction':'up'}") : "", $index < count($inventory) - 1 ? array("name" => "Eins nach unten<img src=\"{$downIcon}\">", "command" => "Order", "namespace" => "explorer", "params" => "{'id':'{$this->id}', 'direction':'down'}") : "", $index != 0 ? array("name" => "Ganz nach oben<img src=\"{$topIcon}\">", "command" => "Order", "namespace" => "explorer", "params" => "{'id':'{$this->id}', 'direction':'top'}") : "", $index < count($inventory) - 1 ? array("name" => "Ganz nach unten<img src=\"{$bottomIcon}\">", "command" => "Order", "namespace" => "explorer", "params" => "{'id':'{$this->id}', 'direction':'bottom'}") : "")), array("name" => "SEPARATOR"), array("raw" => "<a href=\"#\" onclick=\"event.stopPropagation(); removeAllDirectEditors();if (!jQuery('#{$this->id}_1').hasClass('directEditor')) { jQuery('#{$this->id}_1').addClass('directEditor').html(''); var obj = new Object; obj.id = '{$this->id}'; sendRequest('GetDirectEditor', obj, '{$this->id}_1', 'updater',null,null,'explorer'); } jQuery('.popupmenuwapper').parent().html('');jQuery('.open').removeClass('open'); return false;\">Umbenennen<img src=\"{$renameIcon}\"></a>"), $object instanceof \steam_container && $object->get_attribute("bid:presentation") === "index" ? array("name" => "Listenansicht<img src=\"{$blankIcon}\">", "link" => PATH_URL . "Explorer/Index/" . $this->id . "/?view=list") : "", $object instanceof \steam_document && strstr($object->get_attribute(DOC_MIME_TYPE), "text") ? array("name" => "Bearbeiten<img src=\"{$editIcon}\">", "link" => PATH_URL . "Explorer/EditDocument/" . $this->id . "/") : "", array("name" => "Eigenschaften...<img src=\"{$propertiesIcon}\">", "command" => "Properties", "namespace" => "explorer", "params" => "{'id':'{$this->id}'}", "type" => "popup"), array("name" => "Rechte...<img src=\"{$rightsIcon}\">", "command" => "Sanctions", "namespace" => "explorer", "params" => "{'id':'{$this->id}'}", "type" => "popup"));
}
}
$popupMenu->setItems($items);
$popupMenu->setPosition(round($this->x + $this->width - 155) . "px", round($this->y + $this->height + 4) . "px");
$popupMenu->setWidth("170px");
} else {
$copyIcon = $explorerAssetUrl . "icons/menu/copy.png";
$cutIcon = $explorerAssetUrl . "icons/menu/cut.png";
$referIcon = $explorerAssetUrl . "icons/menu/refer.png";
$trashIcon = $explorerAssetUrl . "icons/menu/trash.png";
$hideIcon = $explorerAssetUrl . "icons/menu/hide.png";
$blankIcon = $explorerAssetUrl . "icons/menu/blank.png";
$popupMenu = new \Widgets\PopupMenu();
$items = array(array("raw" => "<a href=\"#\" onclick=\"sendMultiRequest('EmptyTrashbin', getParamsArray({}), getElementIdArray(''), 'updater', null, null, 'explorer', 'Lösche Objekte ...', 0, getSelectionAsArray().length); return false;\">{$count} Objekte löschen<img src=\"{$trashIcon}\"></a>"), array("raw" => "<a href=\"#\" onclick=\"sendMultiRequest('Delete', getParamsArray({}), getElementIdArray(''), 'updater', null, null, 'explorer', 'Lösche Objekte ...', 0, getSelectionAsArray().length); return false;\">{$count} Objekte wiederherstellen<img src=\"{$trashIcon}\"></a>"));
$popupMenu->setItems($items);
$popupMenu->setPosition(round($this->x + $this->width - 155) . "px", round($this->y + $this->height + 4) . "px");
$popupMenu->setWidth("180px");
}
$ajaxResponseObject->setStatus("ok");
$ajaxResponseObject->addWidget($popupMenu);
return $ajaxResponseObject;
}
开发者ID:rolwi,项目名称:koala,代码行数:59,代码来源:GetPopupMenu.class.php
示例18: actionIndex
public function actionIndex()
{
$this->bodyId = 'page-school';
if (Yii::app()->request->isPostRequest) {
$obj = array();
//图片不存在
if (!isset($_FILES['photo'])) {
$obj['extra']['code'] = '400';
exit(json_encode($obj));
}
//图片超过 2M
$maxFileSize = Yii::app()->params['uploadMaxSize'] + 1;
if ($_FILES['photo']['size'] > $maxFileSize) {
$obj['extra']['code'] = '400';
$obj['extra']['errors'] = ['photo' => '最大2M'];
exit(json_encode($obj));
}
if (isset($_POST['project'])) {
$_POST['project'] = json_encode($_POST['project']);
}
$school = new School();
$school->attributes = $_POST;
$school->photo = EEH::moveUploadFile($_FILES['photo'], Yii::app()->params['uploadPathImage'] . 'school_photo/');
// 压缩图片
$info = pathinfo($school->photo);
$smallFile = Yii::app()->params['uploadPathImage'] . 'school_photo/' . $school->photo;
$bigFile = Yii::app()->params['uploadPathImage'] . 'school_photo/' . $info['filename'] . '_origin.' . $info['extension'];
$image = Yii::app()->image->load($smallFile);
$image->save($bigFile);
// 保存原文件
$image->resize(Yii::app()->params['uploadMaxWidth'], Yii::app()->params['uploadMaxHeight'])->quality(Yii::app()->params['uploadQuality']);
$image->save($smallFile);
// 保存压缩后文件
if (!$school->save()) {
$obj['extra']['code'] = '400';
forea
|
请发表评论