本文整理汇总了PHP中Branch类的典型用法代码示例。如果您正苦于以下问题:PHP Branch类的具体用法?PHP Branch怎么用?PHP Branch使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Branch类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: baseInit
/**
* Inicjalizacja formularza
*/
public function baseInit()
{
$this->_atModel = $atModel = new AddonType();
$this->_bModel = $bModel = new Branch();
$rows = $atModel->fetchAll('not ghost', 'name asc');
$addons = array();
foreach ($rows as $row) {
$addons[Base_Convert::strToHex($row->id)] = $row->name;
}
$this->addElement('MultiCheckbox', 'addons', array('label' => 'Uzwględnij następujące dodatki:', 'MultiOptions' => $addons, 'value' => array_keys($addons), 'required' => true));
$this->addons->getDecorator('row')->setOption('class', 'row widerow');
$rows = $bModel->fetchAll('not ghost', 'web_name asc');
$branches = array();
foreach ($rows as $row) {
$branches[Base_Convert::strToHex($row->id)] = $row->branch_name;
}
$this->addElement('MultiCheckbox', 'branches', array('label' => 'Uwzględnij następujące brandy:', 'MultiOptions' => $branches, 'value' => array_keys($branches), 'required' => true));
$dic = new Logic_Dictionary();
$cTypes = array();
$this->_cDic = $cDic = $dic->getDictionaryEntriesByCode('client_type');
foreach ($cDic as $ct) {
$cTypes[Base_Convert::strToHex($ct->id)] = ucfirst($ct->entry);
}
$rows = $bModel->fetchAll('not ghost', 'web_name asc');
$branches = array();
foreach ($rows as $row) {
$branches[Base_Convert::strToHex($row->id)] = $row->branch_name;
}
$this->addElement('MultiCheckbox', 'clients', array('label' => 'Uwzględnij nastepujących klientów:', 'MultiOptions' => $cTypes, 'value' => array_keys($cTypes), 'required' => true));
$this->addElement('Select', 'timepoint', array('label' => 'Wyeksportuj wartości:', 'MultiOptions' => array('now' => 'Aktualne', 'archive' => 'Archiwalne'), 'required' => true));
$this->datee(false, 'date', 'Data:', true, array('value' => date('Y-m-d'), 'required' => true));
$this->addElement('text', 'time', array('label' => 'Godzina:', 'class' => 'timeentry', 'required' => true, 'value' => date('H:00:00'), 'validators' => array(array('validator' => 'Date', 'options' => array('format' => 'H:i:s')))));
$this->submit(false, 'submitbtn', 'Eksportuj');
}
示例2: getBrands
protected function getBrands()
{
$brandModel = new Branch();
$brandsResult = $brandModel->fetchAll();
$brands = array();
foreach ($brandsResult as $brand) {
$brands[$brand->id] = $brand->branch_name;
}
return $brands;
}
示例3: list_drop
function list_drop()
{
$branch = new Branch();
$branch->get();
foreach ($branch as $row) {
$data[''] = '[ Pilih Cabang ]';
$data[$row->branch_name] = $row->branch_name;
}
return $data;
}
示例4: getBranches
public function getBranches()
{
$branchModel = new Branch();
$branches = $branchModel->fetchAll();
$branchOptions = array();
foreach ($branches as $branch) {
$branchOptions[$branch->id] = $branch->web_name;
}
return $branchOptions;
}
示例5: view
public function view()
{
if (!isset($this->request->params['slug'])) {
$this->notice('invalid');
}
$branch = $this->Branch->find('first', array('conditions' => array('Branch.slug' => $this->request->params['slug'], 'Branch.active' => 1), 'contain' => array('Address' => array('fields' => array('Address.address'), 'Country' => array('fields' => array('Country.name'))), 'Contact')));
if (empty($branch)) {
$this->notice(__('The branch does not exsit'), array('redirect' => true));
}
$this->set('title_for_layout', sprintf(__('Contact us at %s'), $branch['Branch']['name']));
$this->set(compact('branch'));
}
示例6: branch
protected function branch($acl = false, $fieldname = 'id_branch', $label = 'Branch', $required = null)
{
$model = new Branch();
$branches = $model->getAllBranches();
$options = array();
foreach ($branches as $branch) {
$options[$branch->id] = $branch->web_name;
}
$method = $acl ? 'addSupervisedElement' : 'addElement';
$this->{$method}('select', $fieldname, array('label' => $label, 'MultiOptions' => $this->addClearStart($options)));
$this->notEmpty($fieldname);
}
示例7: run
public function run()
{
DB::table('branchs')->truncate();
$branch = new Branch();
$branch->name = "Giày dép";
$branch->save();
$branch = new Branch();
$branch->name = "Áo quần";
$branch->save();
$branch = new Branch();
$branch->name = "Phụ kiện";
$branch->save();
}
示例8: getUserBranchName
/** Zwraca nazwę jednostki przez którą użytkownik będzie łączył sie z Def,
* jeżeli wybrany DEF nie jest głównym defem usera zwrócona zostanie defaultowa jednostka
*
* @param string $BaCode - backend_application_code z tabeli backendApplication
* @return string - jednostka przez którą user powinien łączyć się z DEF
*/
public static function getUserBranchName($BaCode)
{
$BaCode = strtolower($BaCode);
$user = Zend_Auth::getInstance()->getIdentity();
$branchName = null;
$branch = new Branch();
if (strtolower($user->jednostka['application_code']) == strtolower($BaCode)) {
$branchName = $user->jednostka['symbol_def'];
} else {
$branchName = $user->default_branches[$BaCode]['symbol_def'];
}
$branchName = $branch->findOne($user->id_branch);
return $branchName->symbol_def;
}
示例9: add
public function add($parentId, Branch $branch)
{
$this->branches[$branch->getNodeId()] = $branch;
if (null === $this->root) {
$this->root = $parentId ? $this->branches[$parentId] = new UnknownNodeBranch($branch) : $branch;
} else {
if (false === isset($this->branches[$parentId])) {
// hidden from nav, don’t return the whole section then:
return $this;
}
$this->branches[$parentId]->add($branch);
}
return $this;
}
示例10: execute
/**
* @param sfWebRequest $request
* @return void
*/
public function execute($request)
{
$projectId = $request->getParameter('project_id');
$baseBranchName = $request->getParameter('base_branch');
$branchName = $request->getParameter('branch');
$commit = (string) $request->getParameter('commit');
// Last commit
$result = array();
file_put_contents(sprintf("%s/api.log", sfConfig::get('sf_log_dir')), sprintf("%s [%s] set review = projectId : %s - baseBranchName : %s - branchName : %s - commit : %s\n", date('d/m/Y H:i:s'), $_SERVER['REMOTE_ADDR'], $projectId, $baseBranchName, $branchName, $commit), FILE_APPEND);
$repository = RepositoryQuery::create()->filterById($projectId)->findOne();
if ($repository) {
$branch = BranchQuery::create()->filterByRepositoryId($repository->getId())->filterByName($branchName)->findOne();
if (!$branch) {
$branch = new Branch();
$branch->setName($branchName)->setRepositoryId($repository->getId())->setBaseBranchName($baseBranchName)->save();
}
if ($branch->getBaseBranchName() != $baseBranchName) {
$branch->setBaseBranchName($baseBranchName)->save();
}
if (($nbFiles = BranchPeer::synchronize($this->gitCommand, $repository, $branch)) != 0) {
$result['message'] = sprintf("Your branch '%s' has too many files : %s (max : %s)", $branch->__toString(), $nbFiles, sfConfig::get('app_max_number_of_files_to_review', 4096));
$this->getResponse()->setStatusCode('500');
} elseif (!$branch->isDeleted()) {
if (strlen($commit) === 40) {
if (!$this->gitCommand->commitIsInHistory($repository->getGitDir(), $branch->getCommitStatusChanged(), $commit)) {
$result['message'] = sprintf("Review has been %sengaged [old status : %s]", $branch->getReviewRequest() ? 're' : '', BranchPeer::getLabelStatus($branch->getStatus()));
$branch->setReviewRequest(1)->setStatus(BranchPeer::A_TRAITER)->setIsBlacklisted(0)->save();
$this->getResponse()->setStatusCode('201');
$this->dispatcher->notify(new sfEvent($this, 'notification.review-request', array('project-id' => $branch->getRepositoryId(), 'object' => $branch)));
} else {
$result['message'] = sprintf("Commit already used : '%s'", $commit);
$this->getResponse()->setStatusCode('200');
}
} else {
$result['message'] = sprintf("No valid commit '%s'", $commit);
$this->getResponse()->setStatusCode('422');
}
} else {
$result['message'] = sprintf("Unknown branch '%s' in project '%s'", $branchName, $repository->getName());
$this->getResponse()->setStatusCode('404');
}
} else {
$result['message'] = sprintf("No valid project '%s'", $projectId);
$this->getResponse()->setStatusCode('400');
}
$this->getResponse()->setContentType('application/json');
return $this->renderText(json_encode($result));
}
示例11: getTable
public function getTable($customerType, $addonType, $version = null)
{
$tableData = new stdClass();
$tableData->header = array('');
$tableData->data = array();
$addonTypeModel = new AddonType();
$addonTypeRow = $addonTypeModel->findOne($addonType);
$addonTypeCode = $addonTypeRow->code;
$branchModel = new Branch();
$branches = $branchModel->fetchAll();
foreach ($branches as $branch) {
$tableData->header[] = $branch->branch_name;
}
$addon = new Addon();
$addonResults = $addon->getOrderedAddons($customerType, $addonType, $version);
$previousStep = null;
$rowArray = array();
foreach ($addonResults as $addonResult) {
if ($addonResult->step_description !== $previousStep) {
if ($previousStep !== null) {
$tableData->data[] = $rowArray;
}
$previousStep = $addonResult->step_description;
switch ($addonTypeCode) {
case 'deposit_period':
$rowArray = array($previousStep);
break;
case 'deposit_amount':
case 'customer_engagement':
$rowArray = array(number_format($previousStep, 0, '.', ' '));
break;
case 'new_old_money':
if ($previousStep == 0) {
$rowArray = array('Stare środki');
} else {
$rowArray = array('Nowe środki');
}
break;
case 'brand':
$rowArray = array('Dodatek');
break;
}
}
$rowArray[] = $addonResult->interest_value;
}
$tableData->data[] = $rowArray;
return $tableData;
}
示例12: show
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($id)
{
$student = Student::find($id);
if ($student == NULL) {
throw new Exception('Invalid Student ID');
}
$student->year = (int) substr($student->year, 2, 4);
$student_category = StudentCategories::find($student->category);
$student->category = $student_category->category;
$student_branch = Branch::find($student->branch);
$student->branch = $student_branch->branch;
if ($student->rejected == 1) {
unset($student->approved);
unset($student->books_issued);
$student->rejected = (bool) $student->rejected;
return $student;
}
if ($student->approved == 0) {
unset($student->rejected);
unset($student->books_issued);
$student->approved = (bool) $student->approved;
return $student;
}
unset($student->rejected);
unset($student->approved);
$student_issued_books = Logs::select('book_issue_id', 'issued_at')->where('student_id', '=', $id)->orderBy('time_stamp', 'desc')->take($student->books_issued)->get();
foreach ($student_issued_books as $issued_book) {
$issue = Issue::find($issued_book->book_issue_id);
$book = Books::find($issue->book_id);
$issued_book->name = $book->title;
$issued_book->issued_at = date('d-M', $issued_book->issued_at);
}
$student->issued_books = $student_issued_books;
return $student;
}
示例13: __construct
public function __construct(Branch $branch = null)
{
parent::__construct(null, null, null, null, null, null, null);
if ($branch) {
$this->add($branch);
}
}
示例14: loginAction
public function loginAction()
{
if ($this->isLogin()) {
$this->redirect(\Func\url('/', true));
}
if ($this->isAjax()) {
$data = $this->request->getPost();
if (empty($data)) {
$this->pageError('param');
}
$modelForm = new OperatorForm('login');
if ($result = $modelForm->validate($data)) {
if ($info = $modelForm->login()) {
if ($info->status == Operator::STATUS_FREEZE) {
$this->error('该账号已冻结');
}
$_sess = ['oid' => $info->oid, 'username' => $info->username, 'rid' => $info->rid, 'rname' => Role::getNameById($info->rid), 'bname' => Branch::getNameById($info->bid), 'bid' => $info->bid, 'auth' => Operator::getAuthByRid($info->rid), 'expire' => time() + $this->getConfig('session', 'expire')];
$this->session->set('operator', $_sess);
$this->success(['msg' => '登录成功', 'redirect' => ['url' => \Func\url('/'), 'seconds' => 0]]);
} else {
$this->error('账号或密码错误');
}
}
$error = $modelForm->getErrors();
if ($error) {
$this->error($error);
}
$this->error('参数错误');
}
$this->single('login');
}
示例15: run
public function run()
{
$faker = Faker::create();
foreach (range(1, 10) as $index) {
Branch::create(['name' => $faker->city, 'address' => $faker->address]);
}
}