Esempio n. 1
0
 public function filterLogin($filterChain)
 {
     $id = Company::getId();
     if (empty($id)) {
         throw new RuntimeException('非法访问');
     }
     $this->comId = $id;
     $this->comName = Company::getName();
     return $filterChain->run();
 }
 /**
  * Draws invoice header
  * 
  * @param null
  * @return null
  */
 function drawInvoiceHeaderBlock()
 {
     //  remember starting coordinates
     $starting_y = $this->GetY();
     $starting_x = $this->GetX();
     $company_image = get_company_invoicing_logo_path();
     if (is_file($company_image)) {
         $this->Image($company_image, $this->GetX(), $this->GetY(), null, 20);
     }
     // if
     $max_y1 = $this->getImageRBY();
     $this->SetX($starting_x);
     $this->SetY($starting_y);
     // draws company details
     $rgb = $this->convertHTMLColorToDec($this->getHeaderFontColor());
     $this->SetTextColor($rgb['R'], $rgb['G'], $rgb['B']);
     $company_name = ConfigOptions::getValue('invoicing_company_name');
     if (!$company_name) {
         $company_name = $this->owner_company->getName();
     }
     // if
     $company_details = ConfigOptions::getValue('invoicing_company_details');
     if (!$company_details) {
         $company_details = '';
         if ($this->owner_company->getConfigValue('office_address')) {
             $company_details .= "\n" . $this->owner_company->getConfigValue('office_address');
         }
         // if
         if ($this->owner_company->getConfigValue('office_phone')) {
             $company_details .= "\n" . $this->owner_company->getConfigValue('office_phone');
         }
         // if
         if ($this->owner_company->getConfigValue('office_fax')) {
             $company_details .= "\n" . $this->owner_company->getConfigValue('office_fax');
         }
         // if
         if ($this->owner_company->getConfigValue('office_homepage')) {
             $company_details .= "\n" . $this->owner_company->getConfigValue('office_homepage');
         }
         // if
     }
     // if
     $this->SetFont('', 'B', $this->font_size);
     $this->Cell(0, $this->line_height, $company_name, 0, 0, 'R');
     $this->Ln();
     $this->SetX($x);
     $this->SetFont('', '', $this->font_size);
     $this->MultiCell(0, $this->line_height, $company_details, 0, 'R', false, 1, '', '', true, 0, false, 1.25);
     $max_y2 = $this->GetY();
     $this->SetX($starting_x);
     $this->SetY(max($max_y1, $max_y2));
 }
 public function mapCompanyToDto(Company $company)
 {
     $companyDto = new CompanyDto();
     $companyDto->setId($company->getId());
     $companyDto->setName($company->getName());
     $companyDto->setContactName($company->getContactName());
     $companyDto->setEmail($company->getEmail());
     $companyDto->setPhoneNumber($company->getPhoneNumber());
     $companyDto->setRegion($company->getRegion());
     $companyDto->setWebsite($company->getWebsite());
     $companyDto->setStatus($company->getStatus());
     return $companyDto;
 }
 /**
  * Delete Company
  *
  * @param void
  * @return null
  */
 function delete()
 {
     if ($this->active_company->isNew()) {
         $this->httpError(HTTP_ERR_NOT_FOUND);
     }
     // if
     if (!$this->active_company->canDelete($this->logged_user)) {
         $this->httpError(HTTP_ERR_FORBIDDEN, null, true, $this->request->isApiCall());
     }
     // if
     if ($this->active_company->isNew() || $this->active_company->isOwner()) {
         $this->httpError(HTTP_ERR_NOT_FOUND, null, true, $this->request->isApiCall());
     }
     // if
     if ($this->request->isSubmitted()) {
         $old_name = $this->active_company->getName();
         $delete = $this->active_company->delete();
         if ($delete && !is_error($delete)) {
             if ($this->request->isApiCall()) {
                 $this->httpOk();
             } else {
                 flash_success("Company ':name' has been deleted", array('name' => $old_name));
                 $this->redirectTo('people');
             }
             // if
         } else {
             if ($this->request->isApiCall()) {
                 $this->httpError(HTTP_ERR_OPERATION_FAILED, null, true, $this->request->isApiCall());
             } else {
                 flash_error("Failed to delete :name", array('name' => $old_name));
                 $this->redirectTo('people');
             }
             // if
         }
         // if
     } else {
         $this->httpError(HTTP_ERR_BAD_REQUEST, null, true, $this->request->isApiCall());
     }
     // if
 }
Esempio n. 5
0
			
			<noscript> <!-- Show a notification if the user has disabled javascript -->
				<div class="notification error png_bg">
					<div>
						Javascript is disabled or is not supported by your browser. Please <a href="http://browsehappy.com/" title="Upgrade to a better browser">upgrade</a> your browser or <a href="http://www.google.com/support/bin/answer.py?answer=23852" title="Enable Javascript in your browser">enable</a> Javascript to navigate the interface properly.
					</div>
				</div>
			</noscript>
			
			<div class="clear"></div> <!-- End .clear -->
			
			<div class="content-box column-left" style="width:63%">				
				<div class="content-box-header">
					
					<h3 style="cursor: s-resize;"><?php 
echo $mCompany->getName();
?>
</h3>
					
					<ul class="content-box-tabs">
						<li><a href="#info" <?php 
if (!isset($_GET['page'])) {
    echo "class='default-tab current'";
}
?>
>Basic Information</a></li> <!-- href must be unique and match the id of target div -->
						<li><a href="#staff" <?php 
if (isset($_GET['page']) && $_GET['page'] == 'staff') {
    echo "class='default-tab current'";
}
?>
Esempio n. 6
0
 public function send()
 {
     $subject = '=?UTF-8?B?' . base64_encode($this->subject) . '?=';
     $support = Company::getSupportEmail();
     if (strlen($support) < 2) {
         $support = '*****@*****.**';
     }
     $from = '=?UTF-8?B?' . base64_encode(Company::getName()) . '?= <' . $support . '>';
     $headers = "MIME-Version: 1.0\r\n" . "Content-Type: text/html; charset=UTF-8\r\n" . "From: {$from}\r\n";
     return mail($this->to, $subject, $this->body, $headers);
 }
Esempio n. 7
0
                $error->message = $vehicle . " is already deployed";
                $result->error = $error;
            } else {
                if ($mVehicle->deploy($imei, $mac)) {
                    $setupResponse->status = "SUCCESS";
                    $vehicle = new TempVehicle();
                    $vehicle->id = $mVehicle->getId();
                    $vehicle->number = $mVehicle->getVehicleNumber();
                    $vehicle->type = $mVehicle->getType();
                    $vehicle->year = $mVehicle->getMakeYear();
                    $vehicle->date_added = $mVehicle->getDateAdded();
                    $result->vehicle = $vehicle;
                    $mCompany = new Company($mVehicle->getCompany());
                    $company = new TempCompany();
                    $company->id = $mVehicle->getCompany();
                    $company->name = $mCompany->getName();
                    $company->phone = $mCompany->getPhone();
                    $mAdmin = new User($mCompany->getAdmin());
                    $admin = new TempAdmin();
                    $admin->id = $mAdmin->getId();
                    $admin->name = $mAdmin->getFullName();
                    $admin->phone = $mAdmin->getPhoneMobile();
                    $company->admin = $admin;
                    $result->company = $company;
                }
            }
        }
    }
} else {
    $setupResponse->status = "FAILURE";
    $error = new Error();
 /**
  * Registration user
  */
 public static function register($model, $post, $role = 'Customer')
 {
     $model->attributes = $post;
     if (isset($_COOKIE['partner'])) {
         $model->pid = intval($_COOKIE['partner']);
     }
     if ($model->validate()) {
         $soucePassword = UserModule::generate_password(8);
         $model->password = UserModule::encrypting($soucePassword);
         $model->superuser = 0;
         $model->status = 1;
         if ($model->save()) {
             $AuthAssignment = new AuthAssignment();
             $AuthAssignment->attributes = array('itemname' => $role, 'userid' => $model->id);
             $AuthAssignment->save();
             if ($role == 'Author') {
                 if ($model->profile == null) {
                     $profile = new Profile();
                     $profile->user_id = $model->id;
                     $profile->mailing_for_executors = 1;
                     $profile->save();
                 }
             }
             $webmasterlog = new WebmasterLog();
             $webmasterlog->pid = $model->pid;
             $webmasterlog->uid = $model->id;
             $webmasterlog->date = date("Y-m-d");
             $webmasterlog->action = WebmasterLog::REG;
             $webmasterlog->save();
             // новая служба системных сообщений
             $type_id = Emails::TYPE_11;
             $email = new Emails();
             $criteria = new CDbCriteria();
             $criteria->order = 'id DESC';
             $criteria->limit = 1;
             $user = User::model()->findAll($criteria);
             $user = $user[0];
             $email->from_id = 1;
             $email->to_id = $user->id;
             $rec = Templates::model()->findAll("`type_id`='{$type_id}'");
             $id = Company::getId();
             $email->company = Company::getName();
             $email->name = $model->full_name;
             $email->login = $model->email;
             $email->password = $soucePassword;
             $email->page_cabinet = 'http://' . $_SERVER['SERVER_NAME'] . '/user/profile/edit';
             $email->sendTo($user->email, $rec[0]->title, $rec[0]->text, $type_id);
             $identity = new UserIdentity($model->email, $soucePassword);
             $identity->authenticate();
             Yii::app()->user->login($identity, 0);
             //$this->redirect(Yii::app()->controller->module->returnUrl[0]);
             return true;
             //Yii::app()->end();
         } else {
             //Yii::app()->user->setFlash('reg_failed',UserModule::t("Sorry, something wrong... :("));
             //$this->refresh();
             echo 'Cant save';
             Yii::app()->end();
         }
     } else {
         return false;
     }
 }
Esempio n. 9
0
        } else {
            $mVehicle = new Vehicle($vehicleId);
            if ($mVehicle->getType() != $type) {
                $setup['setup']['result'] = "fail_type";
                //echo "fail_type";
            } else {
                if ($mVehicle->isDeployed() == 1) {
                    $setup['setup']['result'] = "already";
                    //echo "already";
                } else {
                    if ($mVehicle->deploy()) {
                        $setup['setup']['result'] = "success";
                        $companyId = $mVehicle->getCompany();
                        $setup['setup']['model'] = $mVehicle->getModel();
                        $setup['setup']['type'] = $mVehicle->getType();
                        $setup['setup']['number'] = $mVehicle->getVehicleNumber();
                        $mCompany = new Company($companyId);
                        $setup['setup']['company_name'] = $mCompany->getName();
                        $setup['setup']['owner'] = $mCompany->getAdmin();
                        $setup['setup']['contact'] = $mCompany->getPhone();
                        //echo "success";
                    } else {
                        $setup['setup']['result'] = "fail";
                        //echo "fail";
                    }
                }
            }
        }
        echo json_encode($setup);
    }
}
Esempio n. 10
0
 public function changecompanyAction()
 {
     $session = SessionWrapper::getInstance();
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender(TRUE);
     $formvalues = $this->_getAllParams();
     // debugMessage($formvalues); exit;
     $session->setVar('companyid', $this->_getParam('companyid'));
     $company = new Company();
     $company->populate($this->_getParam('companyid'));
     $companyname = $company->getName();
     $session->setVar(SUCCESS_MESSAGE, "Successfully switched default Company to " . $companyname . ".");
     $url = decode($this->_getParam(URL_SUCCESS));
     /* if($url == "hrmagic.ug" && !isEmptyString($company->getUsername())){
     			$url = "http://".$company->getUsername().".".$url;
     		} */
     $this->_helper->redirector->gotoUrl($url);
 }
 function build_csv_from_company(Company $company, $checked)
 {
     $str = '';
     if (isset($checked['name']) && $checked['name'] == 'checked') {
         $str .= self::build_csv_field($company->getName());
     }
     if (isset($checked['address']) && $checked['address'] == 'checked') {
         $str .= self::build_csv_field($company->getAddress());
     }
     if (isset($checked['address2']) && $checked['address2'] == 'checked') {
         $str .= self::build_csv_field($company->getAddress2());
     }
     if (isset($checked['city']) && $checked['city'] == 'checked') {
         $str .= self::build_csv_field($company->getCity());
     }
     if (isset($checked['state']) && $checked['state'] == 'checked') {
         $str .= self::build_csv_field($company->getState());
     }
     if (isset($checked['zipcode']) && $checked['zipcode'] == 'checked') {
         $str .= self::build_csv_field($company->getZipcode());
     }
     if (isset($checked['country']) && $checked['country'] == 'checked') {
         $str .= self::build_csv_field($company->getCountryName());
     }
     if (isset($checked['phone_number']) && $checked['phone_number'] == 'checked') {
         $str .= self::build_csv_field($company->getPhoneNumber());
     }
     if (isset($checked['fax_number']) && $checked['fax_number'] == 'checked') {
         $str .= self::build_csv_field($company->getFaxNumber());
     }
     if (isset($checked['email']) && $checked['email'] == 'checked') {
         $str .= self::build_csv_field($company->getEmail());
     }
     if (isset($checked['homepage']) && $checked['homepage'] == 'checked') {
         $str .= self::build_csv_field($company->getHomepage());
     }
     if (isset($checked['notes']) && $checked['notes'] == 'checked') {
         $str .= self::build_csv_field($company->getNotes());
     }
     $str = str_replace(array(chr(13) . chr(10), chr(13), chr(10)), ' ', $str);
     //remove line breaks
     return $str;
 }