public function get_content()
 {
     global $USER, $CFG, $DB, $OUTPUT, $SESSION;
     // Only display if you have the correct capability.
     if (!iomad::has_capability('block/iomad_company_admin:company_add', context_system::instance())) {
         return;
     }
     if ($this->content !== null) {
         return $this->content;
     }
     $this->content = new stdClass();
     $this->content->text = '';
     $this->content->footer = '';
     if (empty($this->instance)) {
         return $this->content;
     }
     if (!isloggedin()) {
         $this->content->text = get_string('pleaselogin', 'block_iomad_company_selector');
         return $this->content;
     }
     //  Check users session and profile settings to get the current editing company.
     if (!empty($SESSION->currenteditingcompany)) {
         $selectedcompany = $SESSION->currenteditingcompany;
     } else {
         if (!empty($USER->profile->company)) {
             $usercompany = company::by_userid($USER->id);
             $selectedcompany = $usercompany->id;
         } else {
             $selectedcompany = "";
         }
     }
     // Get the company name if set.
     if (!empty($selectedcompany)) {
         $companyname = company::get_companyname_byid($selectedcompany);
     } else {
         $companyname = "";
     }
     // Get a list of companies.
     $companylist = company::get_companies_select();
     $select = new single_select(new moodle_url('/local/iomad_dashboard/index.php'), 'company', $companylist, $selectedcompany);
     $select->label = get_string('selectacompany', 'block_iomad_company_selector');
     $select->formid = 'choosecompany';
     $fwselectoutput = html_writer::tag('div', $OUTPUT->render($select), array('id' => 'iomad_company_selector'));
     $this->content->text = $OUTPUT->container_start('companyselect');
     if (!empty($SESSION->currenteditingcompany)) {
         $this->content->text .= '<h3>' . get_string('currentcompany', 'block_iomad_company_selector') . ' - ' . $companyname . '</h3>';
     } else {
         $this->content->text .= '<h3>' . get_string('nocurrentcompany', 'block_iomad_company_selector') . '</h3>';
     }
     $this->content->text .= $fwselectoutput;
     $this->content->text .= $OUTPUT->container_end();
     return $this->content;
 }
Ejemplo n.º 2
1
        $searchparams['firstname'] = '%' . $params['firstname'] . '%';
    }
    if (!empty($params['lastname'])) {
        $sqlsearch .= " AND lastname like :lastname ";
        $searchparams['lastname'] = '%' . $params['lastname'] . '%';
    }
    if (!empty($params['email'])) {
        $sqlsearch .= " AND email like :email ";
        $searchparams['email'] = '%' . $params['email'] . '%';
    }
    $userrecords = $DB->get_fieldset_select('user', 'id', $sqlsearch, $searchparams);
} else {
    if (iomad::has_capability('block/iomad_company_admin:editusers', $systemcontext)) {
        // Check if has role edit company users.
        // Get users company association.
        $departmentusers = company::get_recursive_department_users($departmentid);
        if (count($departmentusers) > 0) {
            $departmentids = "";
            foreach ($departmentusers as $departmentuser) {
                if (!empty($departmentids)) {
                    $departmentids .= "," . $departmentuser->userid;
                } else {
                    $departmentids .= $departmentuser->userid;
                }
            }
            if (!empty($showsuspended)) {
                $sqlsearch = " deleted <> 1 AND id in ({$departmentids}) ";
            } else {
                $sqlsearch = " deleted <> 1 AND suspended = 0 AND id in ({$departmentids}) ";
            }
        } else {
 /**
  * Form tweaks that depend on current data.
  */
 public function definition_after_data()
 {
     global $USER, $SESSION;
     $mform =& $this->_form;
     $columns =& $this->_customdata;
     foreach ($columns as $column) {
         if ($mform->elementExists($column)) {
             $mform->removeElement($column);
         }
     }
     // Set the companyid to bypass the company select form if possible.
     if (!empty($SESSION->currenteditingcompany)) {
         $companyid = $SESSION->currenteditingcompany;
     } else {
         $companyid = company_user::companyid();
     }
     // Get the department list.
     $parentlevel = company::get_company_parentnode($companyid);
     if (iomad::has_capability('block/iomad_company_admin:edit_all_departments', context_system::instance())) {
         $userhierarchylevel = $parentlevel->id;
     } else {
         $userlevel = company::get_userlevel($USER);
         $userhierarchylevel = $userlevel->id;
     }
     $this->departmentid = $userhierarchylevel;
     $subhierarchieslist = company::get_all_subdepartments($userhierarchylevel);
     //  Department drop down.
     $mform->insertElementBefore($mform->createElement('select', 'userdepartment', get_string('department', 'block_iomad_company_admin'), $subhierarchieslist, $userhierarchylevel), 'uutypelabel');
     $this->courseselector = $this->add_course_selector();
     $this->add_action_buttons(true, get_string('uploadusers', 'tool_uploaduser'));
 }
 public function definition()
 {
     global $CFG, $PAGE, $DB;
     $context = context_system::instance();
     $mform =& $this->_form;
     $strrequired = get_string('required');
     $mform->addElement('hidden', 'templateid', $this->templateid);
     $mform->addElement('hidden', 'templatename', $this->templaterecord->name);
     $mform->addElement('hidden', 'companyid', $this->companyid);
     $mform->setType('templateid', PARAM_INT);
     $mform->setType('companyid', PARAM_INT);
     $mform->setType('templatename', PARAM_CLEAN);
     $company = new company($this->companyid);
     // Then show the fields about where this block appears.
     $mform->addElement('header', 'header', get_string('email_template', 'local_email', array('name' => $this->templaterecord->name, 'companyname' => $company->get_name())));
     $mform->addElement('text', 'subject', get_string('subject', 'local_email'), array('size' => 100));
     $mform->setType('subject', PARAM_NOTAGS);
     $mform->addRule('subject', $strrequired, 'required');
     /* GWL : To replace text area with Rich text editor make textarea code commented 
     		$mform->addElement('textarea', 'body_editor', get_string('body', 'local_email'), 'wrap="virtual" rows="50" cols="100"');
     		 $mform->addHelpButton('body_editor', 'coursesummary');
     		 $mform->setType('body_editor', PARAM_NOTAGS);
     		 $mform->addRule('body_editor', $strrequired, 'required');
              */
     $mform->addElement('editor', 'emailbody_editor', get_string('body', 'local_email'), null, $this->editoroptions);
     $mform->setType('emailbody', PARAM_RAW);
     //end
     $vars = EmailVars::vars();
     $options = "<option value=''>" . get_string('select_email_var', 'local_email') . "</option>";
     foreach ($vars as $i) {
         $options .= "<option value='{{$i}}'>{$i}</option>";
     }
     /*GWL : Code Add for Placeholders $select = "<select class='emailvars' onchange='window.Perficio.onSelectEmailVar(this)'>
       $options</select>";*/
     $select = "<select class='emailvars'>{$options}</select>";
     // End Code
     $html = "<div class='fitem'><div class='fitemtitle'></div><div class='felement'>\n                 {$select}</div></div>";
     $mform->addElement('html', $html);
     global $PAGE;
     //GWL : Add JS
     $PAGE->requires->jquery();
     $PAGE->requires->js('/local/email/module.js');
     $submitlabel = null;
     // Default.
     if ($this->isadding) {
         $submitlabel = get_string('save_to_override_default_template', 'local_email');
         $mform->addElement('hidden', 'createnew', 1);
         $mform->setType('createnew', PARAM_INT);
     }
     $this->add_action_buttons(true, $submitlabel);
 }
Ejemplo n.º 5
0
 public function add_company_selector($required = true)
 {
     $mform =& $this->_form;
     if (company_user::is_company_user()) {
         $mform->addElement('hidden', 'companyid', company_user::companyid());
     } else {
         $companies = company::get_companies_rs();
         $companyoptions = array('' => get_string('selectacompany', 'block_iomad_company_admin'));
         foreach ($companies as $company) {
             if (company_user::can_see_company($company->shortname)) {
                 $companyoptions[$company->id] = $company->name;
             }
         }
         $companies->close();
         if (count($companyoptions) == 1) {
             $mform->addElement('html', get_string('nocompanies', 'block_iomad_company_admin'));
             return false;
         } else {
             $mform->addElement('select', 'companyid', get_string('company', 'block_iomad_company_admin'), $companyoptions);
             if ($required) {
                 $mform->addRule('companyid', get_string('missingcompany', 'block_iomad_company_admin'), 'required', null, 'client');
             }
             $defaultvalues['companyid'] = array($this->selectedcompany);
             $mform->setDefaults($defaultvalues);
         }
     }
     return true;
 }
Ejemplo n.º 6
0
 function onordercomplete($invoiceitem, $invoice)
 {
     global $DB;
     $transaction = $DB->start_delegated_transaction();
     // Get name for company license.
     $company = company::get_company_byuserid($invoice->userid);
     $course = $DB->get_record('course', array('id' => $invoiceitem->invoiceableitemid), 'id, shortname', MUST_EXIST);
     $licensename = $company->shortname . " [" . $course->shortname . "] " . date("Y-m-d");
     $count = $DB->count_records_sql("SELECT COUNT(*) FROM {companylicense} WHERE name LIKE '" . str_replace("'", "\\'", $licensename) . "%'");
     if ($count) {
         $licensename .= ' (' . ($count + 1) . ')';
     }
     // Create mdl_companylicense record.
     $companylicense = new stdClass();
     $companylicense->name = $licensename;
     $companylicense->allocation = $invoiceitem->license_allocation;
     $companylicense->validlength = $invoiceitem->license_validlength;
     if (!empty($invoiceitem->license_shelflife)) {
         $companylicense->expirydate = $invoiceitem->license_shelflife * 86400 + time();
         // 86400 = 24*60*60 = number of seconds in a day.
     } else {
         $companylicense->expirydate = 0;
     }
     $companylicense->companyid = $company->id;
     $companylicenseid = $DB->insert_record('companylicense', $companylicense);
     // Create mdl_companylicense_courses record for the course.
     $clc = new stdClass();
     $clc->licenseid = $companylicenseid;
     $clc->courseid = $course->id;
     $DB->insert_record('companylicense_courses', $clc);
     // Mark the invoice item as processed.
     $invoiceitem->processed = 1;
     $DB->update_record('invoiceitem', $invoiceitem);
     $transaction->allow_commit();
 }
Ejemplo n.º 7
0
 /**
  * Constructor
  *
  * Sets up and retrieves the API objects
  *
  **/
 public function __construct($company, $user, $course, $invoice, $classroom, $license, $sender, $approveuser)
 {
     $this->company =& $company;
     $this->user =& $user;
     $this->invoice =& $invoice;
     $this->classroom =& $classroom;
     $this->license =& $license;
     $this->sender =& $sender;
     $this->approveuser =& $approveuser;
     if (!isset($this->company)) {
         if (isset($user->id) && !isset($user->profile)) {
             profile_load_custom_fields($this->user);
         }
         if (isset($user->profile["company"])) {
             $this->company = company::by_shortname($this->user->profile["company"])->get('*');
         }
     }
     $this->course =& $course;
     if (!empty($course->id)) {
         $this->course->url = new moodle_url('/course/view.php', array('id' => $this->course->id));
     }
     if (!empty($user->id)) {
         $this->url = new moodle_url('/user/profile.php', array('id' => $this->user->id));
     }
     $this->site = get_site();
 }
 public function __construct($actionurl, $context, $companyid, $departmentid, $licenseid, $courses = array())
 {
     global $USER;
     $this->selectedcompany = $companyid;
     $this->context = $context;
     $this->departmentid = $departmentid;
     $this->licenseid = $licenseid;
     $this->selectedcourses = $courses;
     $company = new company($this->selectedcompany);
     $parentlevel = company::get_company_parentnode($company->id);
     $this->companydepartment = $parentlevel->id;
     if (iomad::has_capability('block/iomad_company_admin:edit_licenses', context_system::instance())) {
         $userhierarchylevel = $parentlevel->id;
     } else {
         $userlevel = company::get_userlevel($USER);
         $userhierarchylevel = $userlevel->id;
     }
     $this->subhierarchieslist = company::get_all_subdepartments($userhierarchylevel);
     if ($this->departmentid == 0) {
         $departmentid = $userhierarchylevel;
     } else {
         $departmentid = $this->departmentid;
     }
     $options = array('context' => $this->context, 'multiselect' => true, 'companyid' => $this->selectedcompany, 'departmentid' => $departmentid, 'subdepartments' => $this->subhierarchieslist, 'parentdepartmentid' => $parentlevel, 'selected' => $this->selectedcourses, 'license' => true);
     $this->currentcourses = new all_department_course_selector('currentcourselicense', $options);
     parent::moodleform($actionurl);
 }
Ejemplo n.º 9
0
 public static function getCompany($company_id)
 {
     global $db;
     $company = null;
     // SQL-spørring for å søke gjennom databasen
     $sql = "SELECT id, navn, description, adresse, postnr, companies.lat, companies.lng, poststedNavn\n\t\t\t\tFROM postnumre, poststed, companies\n\t\t\t\tWHERE (postnumre.poststedID = poststed.poststedID)\n\t\t\t\tAND (companies.postnr = postnumre.postnummer)\n\t\t\t\tAND (id = '" . $company_id . "');";
     $result = $db->query($sql);
     // Lagrer resultater til en array
     while ($row = $result->fetch_object()) {
         $company = new company($row->navn, $row->adresse, $row->postnr, $row->poststedNavn);
         $company->setCompanyId($row->id);
         $company->setDescription($row->description);
     }
     // Returnerer søkeresultatene
     return $company;
 }
 public function __construct($actionurl, $context, $companyid, $departmentid, $userid, $licenseid)
 {
     global $USER, $DB;
     $this->selectedcompany = $companyid;
     $this->context = $context;
     $company = new company($this->selectedcompany);
     $this->parentlevel = company::get_company_parentnode($company->id);
     $this->companydepartment = $this->parentlevel->id;
     $this->licenseid = $licenseid;
     if (iomad::has_capability('block/iomad_company_admin:edit_all_departments', context_system::instance())) {
         $userhierarchylevel = $this->parentlevel->id;
     } else {
         $userlevel = company::get_userlevel($USER);
         $userhierarchylevel = $userlevel->id;
     }
     $this->subhierarchieslist = company::get_all_subdepartments($userhierarchylevel);
     if ($departmentid == 0) {
         $this->departmentid = $userhierarchylevel;
     } else {
         $this->departmentid = $departmentid;
     }
     $this->userid = $userid;
     $this->user = $DB->get_record('user', array('id' => $this->userid));
     parent::__construct($actionurl);
 }
 public function process()
 {
     global $DB;
     if ($this->selectedcompany) {
         $company = new company($this->selectedcompany);
         $companyshortname = $company->get_shortname();
         $companydefaultdepartment = company::get_company_parentnode($company->id);
         // Process incoming assignments.
         if (optional_param('add', false, PARAM_BOOL) && confirm_sesskey()) {
             $userstoassign = $this->potentialusers->get_selected_users();
             if (!empty($userstoassign)) {
                 foreach ($userstoassign as $adduser) {
                     $allow = true;
                     if ($allow) {
                         $user = $DB->get_record('user', array('id' => $adduser->id));
                         // Add user to default company department.
                         $company->assign_user_to_company($adduser->id);
                     }
                 }
                 $this->potentialusers->invalidate_selected_users();
                 $this->currentusers->invalidate_selected_users();
             }
         }
         // Process incoming unassignments.
         if (optional_param('remove', false, PARAM_BOOL) && confirm_sesskey()) {
             $userstounassign = $this->currentusers->get_selected_users();
             if (!empty($userstounassign)) {
                 foreach ($userstounassign as $removeuser) {
                     // Check if the user was a company manager.
                     if ($DB->get_records('company_users', array('userid' => $removeuser->id, 'managertype' => 1))) {
                         $companymanagerrole = $DB->get_record('role', array('shortname' => 'companymanager'));
                         role_unassign($companymanagerrole->id, $removeuser->id, $this->context->id);
                     }
                     if ($DB->get_records('company_users', array('userid' => $removeuser->id, 'managertype' => 2))) {
                         $departmentmanagerrole = $DB->get_record('role', array('shortname' => 'departmentmanager'));
                         role_unassign($departmentmanagerrole->id, $removeuser->id, $this->context->id);
                     }
                     $DB->delete_records('company_users', array('userid' => $removeuser->id));
                     // Deal with the company theme.
                     $DB->set_field('user', 'theme', '', array('id' => $removeuser->id));
                 }
                 $this->potentialusers->invalidate_selected_users();
                 $this->currentusers->invalidate_selected_users();
             }
         }
     }
 }
Ejemplo n.º 12
0
/**
 * Theme functions for companies
 */
function total_companies()
{
    if (!($companies = Registry::get('companies'))) {
        $companies = company::get();
        $companies = new Items($companies);
        Registry::set('companies', $companies);
    }
    return $companies->length();
}
 public function definition()
 {
     global $CFG, $PAGE, $DB;
     $context = context_system::instance();
     $mform =& $this->_form;
     $strrequired = get_string('required');
     $mform->addElement('hidden', 'templateid', $this->templateid);
     $mform->addElement('hidden', 'templatename', $this->templaterecord->name);
     $mform->addElement('hidden', 'companyid', $this->companyid);
     $company = new company($this->companyid);
     // Then show the fields about where this block appears.
     $mform->addElement('header', 'header', get_string('email_template_send', 'local_email', array('name' => $this->templaterecord->name, 'companyname' => $company->get_name())));
     $mform->addElement('static', 'subject', get_string('subject', 'local_email'));
     $mform->addElement('static', 'body', get_string('body', 'local_email'));
     $mform->addElement('header', 'header', get_string('email_data', 'local_email'));
     $this->addHtml($mform, get_string('company', 'block_iomad_company_admin'), $company->get_name());
     $this->addHtml($mform, get_string('select_course', 'local_email'), $this->currentcourses->display(true));
     $this->add_action_buttons(true, get_string('send_emails', 'local_email'));
 }
 public function definition()
 {
     global $CFG, $DB;
     $mform =& $this->_form;
     $company = new company($this->selectedcompany);
     $parentlevel = company::get_company_parentnode($company->id);
     $options = array('context' => context_system::instance(), 'multiselect' => true, 'companyid' => $company->id, 'deptid' => $this->department, 'titleid' => $this->title, 'departmentid' => $parentlevel->id, 'department' => $this->department, 'title' => $this->title, 'exclude' => array(4), 'parentdepartmentid' => $parentlevel, 'licenses' => false, 'shared' => true);
     $this->currentcourses = new current_company_all_course_selector('currentcourses', $options);
     $this->selectedcourses = new department_title_courses('selectedcourses', $options);
     $mform->addElement('hidden', 'department', $this->department);
     $mform->setType('department', PARAM_INT);
     $mform->addElement('hidden', 'title', $this->title);
     $mform->setType('title', PARAM_INT);
     //$courselist = array('Course1', 'Course2', 'Course3', 'Course4');
     // $this->currentcourses->display(true);
     //$select = $mform->addElement('select', 'departmentcourses', get_string('departments', 'local_manage_company_dept_title'), $courselist);
     //$select->setMultiple(true);
     //$select = $mform->addElement('select', 'companycourses', get_string('departments', 'local_manage_company_dept_title'), $courselist);
     //$select->setMultiple(true);
     //$mform->addElement('submit');
 }
Ejemplo n.º 15
0
    $sales = $_POST['sales'] == 'yes' ? $_POST['sales_name'] : '';
    $company_name = $_POST['company_name'];
    $category = implode(",", $_POST['industry']);
    $company_description = $_POST['company_description'];
    $location = $_POST['location'];
    $country = $_POST['country'];
    $registration_no = $_POST['registration_no'];
    $address = $_POST['address'];
    $first_name = $_POST['first_name'];
    $last_name = $_POST['last_name'];
    $designation = $_POST['designation'];
    $contact_no = '+' . $_POST['code'] . "-" . $_POST['mobile'];
    $type = 2;
    $status = 0;
    include_once "../config/company.php";
    $ob = new company();
    $ob->insert_company($company_name, $category, $company_description, $country, $location, $registration_no, $address, $sales, $first_name, $last_name, $designation, $contact_no, $email, $password, $type, $status);
}
?>
		  </div>
		</div>
	</div>	
	<!--footer-->
	<div class="footer">
		<div class="container">
			<div class="footer-left"></div>
			<div class="footer-right">
				<p>© 2015 All rights reserved | Template by <a href="http://w3layouts.com/"> Salaj</a></p>
			</div>
			<div class="clearfix"> </div>
		</div>
Ejemplo n.º 16
0
 public function printTR()
 {
     echo '<tr>';
     $c = new company($this->id_company);
     $company = $c->getName();
     echo '<td>' . $this->name . '</td>';
     echo '<td>' . $company . '</td>';
     echo '<td>' . $this->nationality . '</td>';
     echo '<td>' . $this->mail . '</td>';
     echo '<td>' . $this->phone_number . '</td>';
     echo '<td><a href="../controller/viewCustomer.php?id=' . $this->id . '"><button class=""><span class=\'glyphicon glyphicon-cog\' aria-hidden=\'true\'></span></button></a></td>';
     echo '</tr>';
 }
Ejemplo n.º 17
0
<?php

/**
 * 企业黄页后台管理栏目首页文件
 *
 * @author		Arthur(ArthurXF@gmail.com)
 * @copyright	(c) 2006 by bizeway.com
 * @version		$Id$
 * @package		ArthurXF
 * @subpackage	company
 */
require_once '../config/config.inc.php';
require_once "../class/company.class.php";
require_once '../../useradmin/checklogin.php';
$objWebInit = new company();
//数据库连接参数
$objWebInit->setDBG($arrGPdoDB);
//smarty参数
$objWebInit->arrGSmarty = $arrGSmarty;
//翻页参数
$objWebInit->arrGPage = $arrGPage;
//图片上传参数
$objWebInit->arrGPic = $arrGPic;
$objWebInit->db();
$arrWhere = array();
$arrLink = array();
if (isset($_GET['action'])) {
    if ($_GET['action'] == 'search') {
        // 构造搜索条件和翻页参数
        $arrLink[] = 'action=search';
        if (!empty($_GET['title'])) {
Ejemplo n.º 18
0
 /**
  * Get user completion info for a course
  *
  * Parameters - $departmentid = int;
  *              $courseid = int;
  *              $page = int;
  *              $perpade = int;
  *
  * Return array();
  * */
 public static function get_user_course_completion_data($searchinfo, $courseid, $page = 0, $perpage = 0, $completiontype = 0)
 {
     global $DB;
     $completiondata = new stdclass();
     // Create a temporary table to hold the userids.
     $temptablename = 'tmp_ccomp_users_' . time();
     $dbman = $DB->get_manager();
     // Define table user to be created.
     $table = new xmldb_table($temptablename);
     $table->add_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
     $table->add_field('userid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null);
     $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
     $dbman->create_temp_table($table);
     // Populate it.
     $alldepartments = company::get_all_subdepartments($searchinfo->departmentid);
     if (count($alldepartments) > 0) {
         $tempcreatesql = "INSERT INTO {" . $temptablename . "} (userid) SELECT userid from {company_users}\n                              WHERE departmentid IN (" . implode(',', array_keys($alldepartments)) . ")";
     } else {
         $tempcreatesql = "";
     }
     $DB->execute($tempcreatesql);
     // Deal with completion types.
     if (!empty($completiontype)) {
         if ($completiontype == 1) {
             $completionsql = " AND cc.timeenrolled > 0 AND cc.timestarted = 0 ";
         } else {
             if ($completiontype == 2) {
                 $completionsql = " AND cc.timestarted > 0 AND cc.timecompleted IS NULL ";
             } else {
                 if ($completiontype == 3) {
                     $completionsql = " AND cc.timecompleted IS NOT NULL  ";
                 }
             }
         }
     } else {
         $completionsql = "";
     }
     // Get the user details.
     if ($vantagefield = $DB->get_record('user_info_field', array('shortname' => 'VANTAGE'))) {
         $countsql = "SELECT u.id ";
         $selectsql = "SELECT u.id,\n                    u.firstname AS firstname,\n                    u.lastname AS lastname,\n                    u.email AS email,\n                    cc.timeenrolled AS timeenrolled,\n                    cc.timestarted AS timestarted,\n                    cc.timecompleted AS timecompleted,\n                    d.name as department,\n                    gg.finalgrade as result,\n                    uid.data as vantage ";
         $fromsql = " FROM {user} u, {course_completions} cc, {department} d, {company_users} du,\n                         {user_info_data} uid, {" . $temptablename . "} tt\n                         LEFT JOIN {grade_grades} gg ON ( gg.itemid = (\n                           SELECT id FROM {grade_items} WHERE courseid = {$courseid} AND itemtype='course'))\n\n                    WHERE {$searchinfo->sqlsearch}\n                    AND tt.userid = u.id\n                    AND cc.course = {$courseid}\n                    AND u.id = cc.userid\n                    AND du.userid = u.id\n                    AND d.id = du.departmentid\n                    AND gg.userid = u.id\n                    AND uid.userid = u.id\n                    AND uid.fieldid = {$vantagefield->id}\n                    {$completionsql}\n                    {$searchinfo->sqlsort} ";
     } else {
         $countsql = "SELECT u.id ";
         $selectsql = "SELECT u.id,\n                    u.firstname AS firstname,\n                    u.lastname AS lastname,\n                    u.email AS email,\n                    cc.timeenrolled AS timeenrolled,\n                    cc.timestarted AS timestarted,\n                    cc.timecompleted AS timecompleted,\n                    d.name as department,\n                    gg.finalgrade as result ";
         $fromsql = " FROM {user} u, {course_completions} cc, {department} d, {company_users} du, {" . $temptablename . "} tt\n                         LEFT JOIN {grade_grades} gg ON ( gg.itemid = (\n                           SELECT id FROM {grade_items} WHERE courseid = {$courseid} AND itemtype='course'))\n\n                    WHERE {$searchinfo->sqlsearch}\n                    AND tt.userid = u.id\n                    AND cc.course = {$courseid}\n                    AND u.id = cc.userid\n                    AND du.userid = u.id\n                    AND d.id = du.departmentid\n                    AND gg.userid = u.id\n                    {$completionsql}\n                    {$searchinfo->sqlsort} ";
     }
     $searchinfo->searchparams['courseid'] = $courseid;
     $users = $DB->get_records_sql($selectsql . $fromsql, $searchinfo->searchparams, $page * $perpage, $perpage);
     $countusers = $DB->get_records_sql($countsql . $fromsql, $searchinfo->searchparams);
     $numusers = count($countusers);
     $returnobj = new stdclass();
     $returnobj->users = $users;
     $returnobj->totalcount = $numusers;
     return $returnobj;
 }
<?php

require_once '../model/company.php';
$idCo = $_GET['idCo'];
$idCu = $_GET['idCu'];
$customer = new customer($idCu);
$company = new company($idCo);
$company->setId_contact($idCu);
$company->setToDatabase();
$result = array('idContact' => $idCu, 'contact' => $customer->getName() . ' | ' . $customer->getMail() . ' | ' . $customer->getPhone_number());
echo json_encode($result);
Ejemplo n.º 20
0
<?php 
if (!isset($_SESSION['company_id'])) {
    ?>
	<ul class="breadcrumb">
	    <li><a href="#">Home</a></li>
	    <li><a href="view_company.php">Companies</a></li>
	    <li><a class="active" href="#" >Add</a></li>
	</ul>

<div class="page-heading">
	<h1>Add Company</h1>
</div>

<div class="form-container">
<?php 
    $company = new company();
    $ID = isset($_GET['id']) ? $_GET['id'] : NULL;
    if (isset($_POST['add_company'])) {
        // Update old record
        if (isset($ID)) {
            $results = $company->update_company($_POST, $ID);
        } else {
            // Insert new
            $results = $company->insert_company($_POST);
        }
        if ($results) {
            echo '<div class="alert alert-success" role="alert">';
            echo isset($_GET['id']) ? 'Updated ' : 'Added ';
            echo 'company Sucessfully </div>';
        } else {
            echo '<div class="alert alert-danger" role="alert"> Error </div>';
     $coursecat->sortorder = 999;
     $coursecat->id = $DB->insert_record('course_categories', $coursecat);
     $coursecat->context = context_coursecat::instance($coursecat->id);
     $categorycontext = $coursecat->context;
     $categorycontext->mark_dirty();
     $DB->update_record('course_categories', $coursecat);
     fix_course_sortorder();
     $companydetails = $DB->get_record('company', array('id' => $companyid));
     $companydetails->category = $coursecat->id;
     $DB->update_record('company', $companydetails);
     // code by GWL
     $transaction->allow_commit();
     // End of code
 } else {
     $data->id = $companyid;
     $company = new company($companyid);
     $oldtheme = $company->get_theme();
     $themechanged = $oldtheme != $data->theme;
     $DB->update_record('company', $data);
     if ($themechanged) {
         $company->update_theme($data->theme);
     }
     if (company_user::is_company_user()) {
         company_user::reload_company();
     }
 }
 if (!empty($data->companylogo)) {
     //echo "COMPANYLOGO HERE"; die;
     file_save_draft_area_files($data->companylogo, $context->id, 'theme_' . $data->theme, 'companylogo', $data->id, array('subdirs' => 0, 'maxbytes' => 150 * 1024, 'maxfiles' => 1));
 }
 if (!empty($data->companydomains)) {
Ejemplo n.º 22
0
             $mysql_error = mysql_error();
             if (empty($mysql_error)) {
                 $error_message = 'Some server error occured';
             } else {
                 $error_message = $mysql_error;
             }
             $responce = array('status' => 'failed', 'error' => $error_message, 'data' => array());
         }
     } else {
         $responce = array('status' => 'failed', 'error' => 'Data missing', 'data' => array());
     }
 } else {
     if ($form_id == 27) {
         //shop form
         if (isset($_POST['shop_name']) and !empty($_POST['shop_name']) and isset($_POST['shop_code']) and !empty($_POST['shop_code'])) {
             $company = new company();
             $company->company_name = $_POST['shop_name'];
             $company->company_code = $_POST['shop_code'];
             if ($company->addCompany()) {
                 $responce = array('status' => 'success', 'error' => '', 'data' => array('message' => 'Shop Added successfully'));
             } else {
                 Log::e($tag, "Shop adding failed item : " . $company->to_string() . 'Error : ' . mysql_error());
                 $mysql_error = mysql_error();
                 if (empty($mysql_error)) {
                     $error_message = 'Some server error occured';
                 } else {
                     $error_message = $mysql_error;
                 }
                 $responce = array('status' => 'failed', 'error' => $error_message, 'data' => array());
             }
         } else {
Ejemplo n.º 23
0
<?php

include 'class.php';
$sql = "SELECT id, name FROM company";
$a = new company();
$a->connect();
$result = mysqli_query($a->conn, $sql);
?>

<!DOCTYPE html> 
<html> 
<head>
    <title>Sign In</title> 
    <link type="text/css" rel="stylesheet" href="css.css">
</head> 



<body> 



  	<h1>Sign In</h1> 
<table>
	<tr>
		<td>
			<pre>
				<h2>Personal data</h2><form method ='post' action="dostuff.php">
					User:			<input type="text" name="user">
					E-Mail:		<input type="text" name="mail">
					Password:		<input type="password" name="pass">
Ejemplo n.º 24
0
 /**
  * 根据app_id获取相关信息
  */
 public function config()
 {
     $app_id = intval($this->input['id']);
     if (!$app_id) {
         $this->errorOutput(NO_APP_ID);
     }
     //获取APP信息
     $app_info = $this->api->detail('app_info', array('id' => $app_id, 'del' => 0));
     if (!$app_info) {
         $this->errorOutput(APP_NOT_EXISTS);
     }
     //分享平台数据
     if (isset($app_info['share_plant']) && $app_info['share_plant']) {
         $app_info['share_plant'] = @unserialize($app_info['share_plant']);
     } else {
         $app_info['share_plant'] = array();
     }
     if ($app_info['icon'] && unserialize($app_info['icon'])) {
         $app_info['icon'] = unserialize($app_info['icon']);
         if (IS_REPLACE && REPLACE_IMG_DOMAIN) {
             $app_info['icon']['host'] = REPLACE_IMG_DOMAIN;
         }
         $app_icon = array('web' => $app_info['icon']);
         if ($this->settings['icon_size']) {
             $path = $app_info['icon']['host'] . $app_info['icon']['dir'];
             $file = $app_info['icon']['filepath'] . $app_info['icon']['filename'];
             if ($this->settings['icon_size']['android']) {
                 foreach ($this->settings['icon_size']['android'] as $android) {
                     $size = $android['width'] . 'x' . $android['height'];
                     $url = $path . $size . '/' . $file;
                     switch ($android['width']) {
                         case '36':
                             $key = 'drawable-ldpi';
                             break;
                         case '48':
                             $key = 'drawable-mdpi';
                             break;
                         case '72':
                             $key = 'drawable-hdpi';
                             break;
                         case '96':
                             $key = 'drawable-xhdpi';
                             break;
                         case '144':
                             $key = 'drawable-xxhdpi';
                             break;
                     }
                     if ($key) {
                         $app_icon['android'][$key] = $url;
                     }
                 }
             }
             if ($this->settings['icon_size']['ios']) {
                 foreach ($this->settings['icon_size']['ios'] as $ios) {
                     $size = $ios['width'] . 'x' . $ios['height'];
                     $url = $path . $size . '/' . $file;
                     switch ($ios['width']) {
                         case '57':
                             $key = 'Icon';
                             break;
                         case '114':
                             $key = 'Icon@2x';
                             break;
                         case '120':
                             $key = 'Icon-60@2x';
                             break;
                     }
                     if ($key) {
                         $app_icon['ios'][$key] = $url;
                     }
                 }
             }
         }
         if ($app_icon) {
             $app_info['icon'] = $app_icon;
         }
     }
     if ($app_info['startup_pic'] && unserialize($app_info['startup_pic'])) {
         $app_info['startup_pic'] = unserialize($app_info['startup_pic']);
         if (IS_REPLACE && REPLACE_IMG_DOMAIN) {
             $app_info['startup_pic']['host'] = REPLACE_IMG_DOMAIN;
         }
         $startup_pic = array('web' => $app_info['startup_pic']);
         if ($this->settings['startup_size']) {
             $path = $app_info['startup_pic']['host'] . $app_info['startup_pic']['dir'];
             $file = $app_info['startup_pic']['filepath'] . $app_info['startup_pic']['filename'];
             if ($this->settings['startup_size']['android']) {
                 foreach ($this->settings['startup_size']['android'] as $android) {
                     $size = $android['width'] . 'x' . $android['height'];
                     $url = $path . $size . '/' . $file;
                     $startup_pic['android'] = $url;
                 }
             }
             if ($this->settings['startup_size']['ios']) {
                 foreach ($this->settings['startup_size']['ios'] as $ios) {
                     $size = $ios['width'] . 'x' . $ios['height'];
                     $url = $path . $size . '/' . $file;
                     switch ($size) {
                         case '640x960':
                             $key = 'Default@2x';
                             break;
                         case '640x1136':
                             $key = 'Default-568h@2x';
                             break;
                     }
                     if ($key) {
                         $startup_pic['ios'][$key] = $url;
                     }
                 }
             }
             //iOS有上传图片则覆盖
             if ($app_info['startup_pic2'] && unserialize($app_info['startup_pic2'])) {
                 $startup_pic2 = unserialize($app_info['startup_pic2']);
                 $path = $startup_pic2['host'] . $startup_pic2['dir'];
                 $file = $startup_pic2['filepath'] . $startup_pic2['filename'];
                 $startup_pic['ios']['Default-568h@2x'] = $path . '640x1136/' . $file;
             }
             if ($app_info['startup_pic3'] && unserialize($app_info['startup_pic3'])) {
                 $startup_pic3 = unserialize($app_info['startup_pic3']);
                 $path = $startup_pic3['host'] . $startup_pic3['dir'];
                 $file = $startup_pic3['filepath'] . $startup_pic3['filename'];
                 $startup_pic['ios']['Default@2x'] = $path . '640x960/' . $file;
             }
         }
         if ($startup_pic) {
             $app_info['startup_pic'] = $startup_pic;
         }
     }
     if ($app_info['is_show_guide']) {
         //获取APP引导图
         $guideCondition = array('app_id' => $app_id, 'effect' => $app_info['guide_effect']);
         $guide_pic = $this->api->app_pic($guideCondition);
         if ($guide_pic) {
             $guide_pic_arr = array();
             foreach ($guide_pic as $k => $guide) {
                 if ($guide['type'] == 1) {
                     $guide_type = 'fg';
                 } elseif ($guide['type'] == 2) {
                     $guide_type = 'bg';
                 }
                 if (IS_REPLACE && REPLACE_IMG_DOMAIN) {
                     $guide['info']['host'] = REPLACE_IMG_DOMAIN;
                 }
                 $guide_pic_arr[$guide_type][$k]['web'] = $guide['info'];
                 if ($this->settings['guide_size']) {
                     $path = $guide['info']['host'] . $guide['info']['dir'];
                     $file = $guide['info']['filepath'] . $guide['info']['filename'];
                     if ($this->settings['guide_size']['android']) {
                         foreach ($this->settings['guide_size']['android'] as $android) {
                             if ($guide['type'] == 2 && $app_info['guide_effect'] == 'effect2') {
                                 $size = 'x800';
                             } else {
                                 $size = $android['width'] . 'x' . $android['height'];
                             }
                             $url = $path . $size . '/' . $file;
                             $guide_pic_arr[$guide_type][$k]['android'] = $url;
                         }
                     }
                     if ($this->settings['guide_size']['ios']) {
                         foreach ($this->settings['guide_size']['ios'] as $ios) {
                             if ($guide['type'] == 2 && $app_info['guide_effect'] == 'effect2') {
                                 $size = 'x1136';
                             } else {
                                 $size = $ios['width'] . 'x' . $ios['height'];
                             }
                             $url = $path . $size . '/' . $file;
                             $guide_pic_arr[$guide_type][$k]['ios'] = $url;
                         }
                     }
                 }
             }
             if (!$guide_pic_arr) {
                 $guide_pic_arr = $guide_pic;
             }
             $app_info['guide_pic'] = $guide_pic_arr;
         }
     }
     if ($this->settings['data_url']) {
         $app_info['base_url'] = trim($this->settings['data_url']['path'], '/') . '/' . $app_info['user_id'] . '/';
     }
     //天气接口
     if (WEATHER_API) {
         $app_info['weather_api'] = WEATHER_API;
     }
     //统计接口
     if (STATISTICS_API) {
         $app_info['statistics_api'] = STATISTICS_API;
     }
     //会员接口
     if (MEMBER_API) {
         $app_info['member_api'] = MEMBER_API;
     }
     //互助接口
     if (SEEKHELP_API) {
         $app_info['seekhelp_api'] = SEEKHELP_API;
     }
     //获取推送id和key
     include_once ROOT_PATH . 'lib/class/company.class.php';
     $companyApi = new company();
     $push_api = $companyApi->getPushApi($this->user['user_id']);
     if ($push_api) {
         $app_info['push_api'] = $push_api;
         $app_info['prov_id'] = $push_api['prov_id'];
     }
     //获取APP打包程序数据
     $app_info['client'] = $this->api->get_version_info($app_id);
     //获取APP模板信息
     $temp_info = $this->api->detail('app_template', array('id' => $app_info['temp_id']));
     if ($temp_info) {
         if (unserialize($temp_info['pic'])) {
             $temp_info['pic'] = unserialize($temp_info['pic']);
             if (IS_REPLACE && REPLACE_IMG_DOMAIN) {
                 $temp_info['pic']['host'] = REPLACE_IMG_DOMAIN;
             }
         }
         $app_info['template'] = $temp_info;
         //获取APP模板的属性
         include_once CUR_CONF_PATH . 'lib/appTemplate.class.php';
         $tempApi = new appTemplate();
         $temp_attr = $tempApi->get_attribute($app_info['temp_id'], $app_id, true);
         if ($temp_attr) {
             $temp_attr = $temp_attr[$app_info['temp_id']];
             foreach ($temp_attr as $k => $attr) {
                 if ($attr['mark'] == 'homeBackground') {
                     unset($temp_attr[$k]);
                     continue;
                 }
                 if (is_string($attr['attr_value']) && strpos($attr['attr_value'], '|')) {
                     $arr = explode('|', $attr['attr_value']);
                     $arr_list = array();
                     foreach ($arr as $value) {
                         $vv = explode(':', $value);
                         $arr_list[$vv[0]] = $vv[1];
                     }
                     $temp_attr[$k]['attr_value'] = $arr_list;
                 }
             }
             $app_info['template']['attrs'] = $temp_attr;
         }
     }
     //获取APP模块信息
     include_once CUR_CONF_PATH . 'lib/appModule.class.php';
     $moduleApi = new appModule();
     include_once CUR_CONF_PATH . 'lib/appInterface.class.php';
     $ui_api = new appInterface();
     $condition = array('app_id' => $app_id);
     if ($this->user['user_id']) {
         $condition['uid'] = $this->user['user_id'];
     }
     $module_info = $moduleApi->show(array('count' => -1, 'condition' => $condition));
     if ($module_info) {
         $ui_id = array();
         foreach ($module_info as $k => $module) {
             if ($module['pic'] && is_array($module['pic']) && $this->settings['module_size']) {
                 if (IS_REPLACE && REPLACE_IMG_DOMAIN) {
                     $module['pic']['host'] = REPLACE_IMG_DOMAIN;
                 }
                 $module_icon = array('web' => $module['pic']);
                 if ($this->settings['module_size']) {
                     $path = $module['pic']['host'] . $module['pic']['dir'];
                     $file = $module['pic']['filepath'] . $module['pic']['filename'];
                     if ($this->settings['module_size']['android']) {
                         foreach ($this->settings['module_size']['android'] as $android) {
                             $size = $android['width'] . 'x' . $android['height'];
                             $url = $path . $size . '/' . $file;
                             $module_icon['android'] = $url;
                         }
                     }
                     if ($this->settings['module_size']['ios']) {
                         foreach ($this->settings['module_size']['ios'] as $ios) {
                             $size = $ios['width'] . 'x' . $ios['height'];
                             $url = $path . $size . '/' . $file;
                             $module_icon['ios'] = $url;
                         }
                     }
                 }
                 if ($module_icon) {
                     $module_info[$k]['pic'] = $module_icon;
                 }
             }
             if ($module['press_pic'] && is_array($module['press_pic']) && $this->settings['module_size']) {
                 if (IS_REPLACE && REPLACE_IMG_DOMAIN) {
                     $module['press_pic']['host'] = REPLACE_IMG_DOMAIN;
                 }
                 $module_icon = array('web' => $module['press_pic']);
                 if ($this->settings['module_size']) {
                     $path = $module['press_pic']['host'] . $module['press_pic']['dir'];
                     $file = $module['press_pic']['filepath'] . $module['press_pic']['filename'];
                     if ($this->settings['module_size']['android']) {
                         foreach ($this->settings['module_size']['android'] as $android) {
                             $size = $android['width'] . 'x' . $android['height'];
                             $url = $path . $size . '/' . $file;
                             $module_icon['android'] = $url;
                         }
                     }
                     if ($this->settings['module_size']['ios']) {
                         foreach ($this->settings['module_size']['ios'] as $ios) {
                             $size = $ios['width'] . 'x' . $ios['height'];
                             $url = $path . $size . '/' . $file;
                             $module_icon['ios'] = $url;
                         }
                     }
                 }
                 if ($module_icon) {
                     $module_info[$k]['press_pic'] = $module_icon;
                 }
             }
             if ($module['ui_id']) {
                 $ui_id[$module['ui_id']] = $module['ui_id'];
             }
         }
         if ($ui_id) {
             $ui_id = implode(',', $ui_id);
             $ui_info = $ui_api->show(array('count' => -1, 'condition' => array('id' => $ui_id)));
             if ($ui_info) {
                 foreach ($module_info as $k => $v) {
                     //获取界面对应的属性
                     $ui_attr = $ui_api->get_attribute($v['ui_id'], $v['id'], true);
                     if ($ui_attr && $ui_attr[$v['ui_id']]) {
                         $ui_info[$v['ui_id']]['attr'] = $ui_attr[$v['ui_id']];
                     }
                     if ($ui_info[$v['ui_id']]) {
                         $module_info[$k]['ui'] = $ui_info[$v['ui_id']];
                     }
                 }
             }
         }
         $app_info['module'] = $module_info;
     }
     if ($this->input['flag']) {
         $app_cache = $this->api->detail('app_cache', array('app_id' => $app_id));
         if (!$app_cache) {
             $insertData = array('app_id' => $app_id, 'data' => serialize($app_info));
             $this->api->create('app_cache', $insertData);
             $app_info['unpack'] = 1;
         } else {
             if ($app_cache && unserialize($app_cache['data'])) {
                 $app_cache_data = unserialize($app_cache['data']);
                 //暂时去除验证设置是否改动
                 //if ($this->compare_data($app_info, $app_cache_data))
                 //{
                 //    $app_info['unpack'] = 0;
                 //}
                 //else
                 //{
                 $this->api->update('app_cache', array('data' => serialize($app_info)), array('app_id' => $app_id));
                 if ($app_info['client']) {
                     /*
                     $updateData = array(
                         'file_url' => '',
                         'download_url' => '',
                         'file_size' => 0,
                         'state' => 0,
                         'publish_time' => 0,
                         'push' => 0
                     );
                     foreach ($app_info['client'] as $k => $client)
                     {
                         $updateData['version_name'] = $client['version_name'] + 1;
                         $updateData['version_code'] = $client['version_code'] + 1;
                         $updateCondition = array(
                                 		                'app_id' => $app_id,
                                 		                'client_id' => $client['client_id']
                                 		            );
                                 		            if ($this->api->update('client_relation', $updateData, $updateCondition))
                                 		            {
                                 		                $app_info['client'][$k]['version_name'] = $updateData['version_name'];
                                 		                $app_info['client'][$k]['version_code'] = $updateData['version_code'];
                                 		            }
                     }
                     */
                 }
                 $app_info['unpack'] = 2;
                 //}
             } else {
                 $app_info['unpack'] = 0;
             }
         }
     }
     $this->addItem($app_info);
     $this->output();
 }
Ejemplo n.º 25
0
function get_form_html($form_id, $id)
{
    ob_start();
    ?>
    <div id="head_div" style="padding: 5px 0; background-color: #ECECEC;  color: #21ACD7;
         border-radius: 5px;margin-left: auto; text-align: center; ">
        <?php 
    $user = new user();
    $user->id = $_SESSION['user_id'];
    $user->getUser();
    $company = new company();
    $company->id = $user->company_id;
    $company->getCompany();
    echo "STOCK REPORT OF {$company->company_name} - {$company->company_code}";
    ?>
    </div>
    <div style="margin-top: 10px; background-color:transparent;padding-bottom: 30px;">
        <style>
            div#purchace_items td,div#purchace_items th{
                border: 1px solid #21ACD7;
            }
            div#purchace_items tbody td{
                padding: 5px 0 5px 5px;
            }
            div#purchace_items tbody td input,div#purchace_items tbody td select{
                padding: 0;
                border: 0;
                margin: 0;
                height: 100%;
                width: 100%;
                background-color: transparent;
            }
        </style>
        <input type="text" id="search" placeholder="Enter Search Key here..." style="width: 100%; margin-left: 0px;" onkeyup="search()" />
        <style>
            img#search{
                position: relative;
                height: 20px;
                width: 20px;
                float: right;
                top: -29px;
                right: 10px;
            }
        </style>
        <img id="search" src="../ui/images/search.png" onclick="search()" />
        <div id="purchace_items" style="width: 100%; padding: 10px 0; color: #21ACD7;">           
            <table id="items_table" style="border-collapse: collapse; width: 100%; 
                   background-color: #fff; border-radius: 10px;  color: #21ACD7;">
                <thead style="text-align: center;">
                    <tr  status="not_selected">
                        <th>
                            #
                        </th>
                        <th>
                            ITEM
                        </th>
                        <th>
                            STOCK COUNT
                        </th>
                        <th style="">
                            SELLING PRIZE
                        </th>
                        <th style="">
                            TAX
                        </th>
                    </tr>
                </thead>
                <tbody style="padding-left: 3px; text-align: center; ">
                    <?php 
    $inventry = new inventry();
    $inventries = $inventry->getInventryForSpecificCompany($user->company_id);
    $i = 0;
    if ($inventries == NULL || sizeof($inventries) == 0) {
        echo '<tr><td colspan="8"> No Stock Found </td></tr>';
    } else {
        foreach ($inventries as $inventry) {
            ?>
                        <tr id="<?php 
            echo $inventry->id;
            ?>
"  onclick="select_row(this)" status="not_selected">
                            <td style="text-align: center;">
                                <?php 
            echo ++$i;
            ?>
                            </td>
                            <td id="item_name"><?php 
            $item = new item();
            $item->id = $inventry->item_id;
            $item->getItem();
            echo $item->item_name . ' (' . $item->item_code . ')';
            ?>
</td>
                            <td id="in_stock_count"><?php 
            echo number_format($inventry->in_stock_count, 3, '.', '');
            ?>
</td>
                            <td id="mrp"><?php 
            echo number_format($inventry->selling_prize, 2, '.', '');
            ?>
</td>
                            <td id="tax_category" tax_category_id="<?php 
            echo $inventry->tax_category_id;
            ?>
"><?php 
            $tax = new tax_category();
            $tax->id = $inventry->tax_category_id;
            $tax->getTaxCategory();
            echo $tax->tax_category_name;
            ?>
</td>
                        </tr>
                    <?php 
        }
    }
    ?>
                </tbody>                               
            </table>
        </div>
    </div>
    <script type="text/javascript">
        function select_row(row) {
            var j_row = $(row);
            if(j_row.attr('status') == 'selected'){
                $('table#items_table tr').attr('status', 'not_selected');
                $('table#items_table tr').css('background-color', '#FFF');
                $('img#edit').css('display', 'none');
                $('img#edit_fade').css('display', 'block');
                $('img#delete').css('display', 'none');
                $('img#delete_fade').css('display', 'block');
            }else{            
                $('table#items_table tr').attr('status', 'not_selected');
                $('table#items_table tr').css('background-color', '#FFF');
                j_row.attr('status', 'selected');
                j_row.css('background-color', '#C0EFFD');
                $('img#edit').css('display', 'block');
                $('img#edit_fade').css('display', 'none');
                $('img#delete').css('display', 'block');
                $('img#delete_fade').css('display', 'none');
            }          
        }
        function on_edit_clicked(){
            var selected_row = $('tr[status="selected"]');
            var item_name = selected_row.find('td#item_name').html();
            var id = selected_row.attr('id');
            var instock_count = selected_row.find('td#in_stock_count').html();
            var mrp = selected_row.find('td#mrp').html();
            var tax_category_id = selected_row.find('td#tax_category').attr('tax_category_id');
            get_form(25,  ///inventry edit form
                function (html, tools){
                    $('div#form-body').html(html);
                    $('div#content-body-action-tools').html(tools);
                    var form = $('div#form-body').find('form.action_form');
                    form.attr('operation', 'update');
                    form.attr('inventry_id', id);
                    form.find('input#item_name').val(item_name);
                    form.find('input#in_stock_count').val(instock_count);
                    form.find('input#in_stock_count').prop('disabled', null);
                    form.find('input#mrp').val(mrp);
                    form.find('input#mrp').prop('disabled', null);
                    form.find('select#tax_category').find('option#'+tax_category_id).prop('selected', true);
                    form.find('select#tax_category').prop('disabled', null);
                    form.find('input[type=submit]').val('UPDATE');
                    form.find('input[type=submit]').prop('disabled', null);
                    form.find('input[type=reset]').prop('disabled', null);
                    $('div#head_div').html('ID : INVENTRY-'+id);
                    $('div#head_div').css('display', 'block');
                },
                function (message){
                    $('font#section_heading').empty();
                    $('div#form-body').empty();
                    alert(message);
                }
             );
        }
        function on_delete_clicked(){            
            var selected_row = $('tr[status="selected"]');
            var id = selected_row.attr('id');
            if(confirm('Are you sure you want to delete INVENTRY-'+id+' ?' )){
                var data = {
                    form_id : 20,
                    inventry_id : id
                }
                delete_form_data(data, function(message) {
                    get_form(20,
                        function(html, tools) {
                             $('div#form-body').html(html);
                             $('div#content-body-action-tools').html(tools);
                        }, function(message) {
                             $('font#section_heading').empty();
                             $('div#form-body').empty();
                             alert(message);
                        });
                    alert(message);
                }, function(message) {
                    alert(message);
                });
            }
        }
        
        function on_print_clicked() {
            //var date = $('input#date_field').val();
            var d = new Date();
            var date = d.getDate()+"/"+(parseInt(d.getMonth())+parseInt(1))+"/"+d.getFullYear();
            
            $('div#print_container_header')
                    .html('<font style="color:#21ACD7; font-size:20px; ">STOCK REPORT OF '+date+'</font>');
            var html = $('div#purchace_items').html();
            $('div#print_container_body').html(html);  
            print();
            $('div#print_container_header').empty();
            $('div#print_container_body').empty();
            $('div#print_container_footer').empty();
        }
        
        function search(){
            var search_key = $('input#search').val();
            if(search_key !== ''){                
                console.log("search key "+ search_key);
                searchTable(search_key);
            }else{
                $('#items_table tr').show();
            }
        }
        function searchTable(inputVal)
        {
                var table = $('#items_table');
                table.find('tr').each(function(index, row)
                {
                        var allCells = $(row).find('td');
                        if(allCells.length > 0)
                        {
                                var found = false;
                                allCells.each(function(index, td)
                                {
                                        var regExp = new RegExp(inputVal, 'i');
                                        if(regExp.test($(td).text()))
                                        {
                                                found = true;
                                                return false;
                                        }
                                });
                                if(found == true)$(row).show();else $(row).hide();
                        }
                });
        }
    </script>

    <?php 
    $form = ob_get_clean();
    return $form;
}
Ejemplo n.º 26
0
    $count = count($orders);
    foreach ($orders as $order) {
        $ca += $order->getPrice();
    }
    $ca = number_format($ca, 2, ',', ' ');
    //On regroupe les commandes par leur client
    $companies = array();
    function search($id, $company)
    {
        $mag = false;
        foreach ($company as $i => $item) {
            if ($item->getId() == $id) {
                $mag = $i;
            }
        }
        return $mag;
    }
    foreach ($orders as $order) {
        $tag = search($order->getId_company(), $companies);
        if ($tag !== false) {
            $companies[$tag]->addOrder($order);
        } else {
            $new_company = new company($order->getId_company());
            $new_company->addOrder($order);
            array_push($companies, $new_company);
        }
    }
} else {
    $display = false;
}
include '../view/dashBoard.php';
 public function find_courses($search)
 {
     global $CFG, $DB, $SITE;
     require_once $CFG->dirroot . '/local/iomad/lib/company.php';
     // By default wherecondition retrieves all courses except the deleted, not confirmed and guest.
     list($wherecondition, $params) = $this->search_sql($search, 'c');
     $params['companyid'] = $this->companyid;
     $params['siteid'] = $SITE->id;
     $userdepartment = company::get_userlevel($this->user);
     if (!($companycourses = $DB->get_records('company_course', array('companyid' => $this->companyid), null, 'courseid'))) {
         $companysql = " AND 1=0";
     } else {
         $companysql = " AND c.id in (" . implode(',', array_keys($companycourses)) . ") ";
     }
     $deptids = company::get_recursive_department_courses($userdepartment->id);
     $departmentcondition = "";
     if (!empty($deptids)) {
         foreach ($deptids as $deptid) {
             if (empty($departmentcondition)) {
                 $departmentcondition = " AND cc.courseid in (" . $deptid->courseid;
             } else {
                 $departmentcondition .= "," . $deptid->courseid;
             }
         }
         $departmentcondition .= ") ";
     }
     $currentcourses = enrol_get_users_courses($this->user->id, true, null, 'visible DESC, sortorder ASC');
     if (!empty($currentcourses)) {
         $currentcoursesql = "AND c.id not in (" . implode(',', array_keys($currentcourses)) . ")";
     } else {
         $currentcoursesql = "";
     }
     if ($licensecourses = $DB->get_records('iomad_courses', array('licensed' => 1), null, 'courseid')) {
         $licensesql = " AND c.id not in (" . implode(',', array_keys($licensecourses)) . ")";
     } else {
         $licensesql = "";
     }
     $fields = 'SELECT ' . $this->required_fields_sql('c');
     $countfields = 'SELECT COUNT(1)';
     $distinctfields = 'SELECT DISTINCT ' . $this->required_fields_sql('c');
     $distinctcountfields = 'SELECT COUNT(DISTINCT c.id) ';
     $sql = " FROM {course} c,\n                        {company_course} cc\n                        WHERE cc.courseid = c.id\n                        AND {$wherecondition}\n                        {$companysql}\n                        {$departmentcondition}\n                        {$currentcoursesql}\n                        {$licensesql}";
     // Deal with shared courses.
     if ($this->shared) {
         if ($this->licenses) {
             $sharedsql = " FROM {course} c\n                               INNER JOIN {iomad_courses} pc\n                               ON c.id=pc.courseid\n                               WHERE pc.shared=1\n                               AND pc.licensed != 1";
             $partialsharedsql = " FROM {course} c\n                                    WHERE c.id IN (SELECT pc.courseid from {iomad_courses} pc\n                                    INNER JOIN {company_shared_courses} csc ON pc.courseid=csc.courseid\n                                       where pc.shared=2 AND pc.licensed !=1 AND csc.companyid = :companyid)";
         } else {
             $sharedsql = " FROM {course} c INNER JOIN {iomad_courses} pc ON c.id=pc.courseid WHERE pc.shared=1";
             $partialsharedsql = " FROM {course} c\n                                    WHERE c.id IN (SELECT pc.courseid from {iomad_courses} pc\n                                    INNER JOIN {company_shared_courses} csc ON pc.courseid=csc.courseid\n                                       where pc.shared=2 AND csc.companyid = :companyid)";
         }
     } else {
         $sharedsql = " FROM {course} c WHERE 1 = 2";
         $partialsharedsql = " FROM {course} c WHERE 1 = 2";
     }
     $order = ' ORDER BY c.fullname ASC';
     if (!$this->is_validating()) {
         $potentialmemberscount = $DB->count_records_sql($countfields . $sql, $params) + $DB->count_records_sql($countfields . $sharedsql, $params) + $DB->count_records_sql($countfields . $partialsharedsql, $params);
         if ($potentialmemberscount > company_course_selector_base::MAX_COURSES_PER_PAGE) {
             return $this->too_many_results($search, $potentialmemberscount);
         }
     }
     $availablecourses = $DB->get_records_sql($fields . $sql . $order, $params) + $DB->get_records_sql($fields . $sharedsql . $order, $params) + $DB->get_records_sql($fields . $partialsharedsql . $order, $params);
     if (empty($availablecourses)) {
         return array();
     }
     if ($search) {
         $groupname = get_string('potcoursesmatching', 'block_iomad_company_admin', $search);
     } else {
         $groupname = get_string('potcourses', 'block_iomad_company_admin');
     }
     return array($groupname => $availablecourses);
 }
Ejemplo n.º 28
0
<?php

defined('IN_DESTOON') or exit('Access Denied');
require MD_ROOT . '/company.class.php';
$do = new company();
$menus = array(array($MOD['name'] . '列表', '?moduleid=' . $moduleid), array('移动地区', '?moduleid=' . $moduleid . '&action=move'), array(VIP . '管理', '?moduleid=' . $moduleid . '&file=vip'), array('会员列表', '?moduleid=2'));
$this_forward = '?moduleid=' . $moduleid . '&file=' . $file;
if ($_catids || $_areaids) {
    if (isset($userid)) {
        $itemid = $userid;
    }
    if (isset($member['areaid'])) {
        $post['areaid'] = $member['areaid'];
    }
    require DT_ROOT . '/admin/admin_check.inc.php';
}
switch ($action) {
    case 'update':
        is_array($userid) or msg('请选择' . $MOD['name']);
        foreach ($userid as $v) {
            $do->update($v);
        }
        dmsg('更新成功', $forward);
        break;
    case 'move':
        if ($submit) {
            $fromids or msg('请填写来源ID');
            if ($toareaid) {
                $db->query("UPDATE {$table} SET areaid={$toareaid} WHERE `{$fromtype}` IN ({$fromids})");
                $db->query("UPDATE {$DT_PRE}member SET areaid={$toareaid} WHERE `{$fromtype}` IN ({$fromids})");
            }
Ejemplo n.º 29
0
 public static function get_all_regions($companyid)
 {
     global $DB;
     if (!($parentnode = company::get_company_parentnode($companyid))) {
         return false;
     }
     return $DB->get_records('department', array('company' => $companyid, 'level' => 0, 'parent' => $parentnode->id));
 }
Ejemplo n.º 30
-1
<?php

require_once 'object_set.php';
class company extends object_set
{
    function table_name()
    {
        return "t_company";
    }
    function auto_id()
    {
        return true;
    }
}
$company = new company();
$company->process();