本文整理汇总了PHP中Branch类的典型用法代码示例。如果您正苦于以下问题:PHP Branch类的具体用法?PHP Branch怎么用?PHP Branch使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Branch类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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');
}
开发者ID:knatorski,项目名称:SMS,代码行数:37,代码来源:Print.php
示例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;
}
开发者ID:knatorski,项目名称:SMS,代码行数:10,代码来源:Calculate.php
示例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;
}
开发者ID:anggadjava,项目名称:payroll,代码行数:10,代码来源:branch.php
示例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;
}
开发者ID:knatorski,项目名称:SMS,代码行数:10,代码来源:Add.php
示例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'));
}
开发者ID:nani8124,项目名称:infinitas,代码行数:12,代码来源:BranchesController.php
示例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);
}
开发者ID:knatorski,项目名称:SMS,代码行数:12,代码来源:Filter.php
示例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();
}
开发者ID:hungleon2112,项目名称:giaymaster,代码行数:13,代码来源:BranchTableSeeder.php
示例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;
}
开发者ID:knatorski,项目名称:SMS,代码行数:20,代码来源:Factory.php
示例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;
}
开发者ID:arsthanea,项目名称:kunstmaan-extra-bundle,代码行数:14,代码来源:TreeBuilder.php
示例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));
}
开发者ID:ratibus,项目名称:Crew,代码行数:52,代码来源:setAction.class.php
示例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;
}
开发者ID:knatorski,项目名称:SMS,代码行数:48,代码来源:Internalbase.php
示例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;
}
开发者ID:linpar,项目名称:library-management-system,代码行数:41,代码来源:StudentController.php
示例13: __construct
public function __construct(Branch $branch = null)
{
parent::__construct(null, null, null, null, null, null, null);
if ($branch) {
$this->add($branch);
}
}
开发者ID:arsthanea,项目名称:kunstmaan-extra-bundle,代码行数:7,代码来源:UnknownNodeBranch.php
示例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');
}
开发者ID:Crocodile26,项目名称:php-1,代码行数:31,代码来源:PublicController.php
示例15: run
public function run()
{
$faker = Faker::create();
foreach (range(1, 10) as $index) {
Branch::create(['name' => $faker->city, 'address' => $faker->address]);
}
}
开发者ID:bryanestrito,项目名称:datawarehouse_etl,代码行数:7,代码来源:BranchesTableSeeder.php
示例16: archive
public function archive($publicId)
{
$branch = Branch::scope($publicId)->firstOrFail();
$branch->delete();
Session::flash('message', trans('texts.archived_branch'));
return Redirect::to('company/branches');
}
开发者ID:Vrian7ipx,项目名称:cascadadev,代码行数:7,代码来源:BranchController.php
示例17: editAction
/**
* 编辑门店信息
*/
public function editAction()
{
if ($this->isAjax()) {
$data = $this->request->getPost();
$modelForm = new BranchForm('edit');
if ($modelForm->validate($data)) {
if ($modelForm->edit()) {
$this->success('操作成功');
} else {
$this->error('操作失败');
}
} else {
$this->error('验证失败');
}
exit;
}
$id = $this->dispatcher->getParams()[0];
if (empty($id)) {
$this->pageError('param');
}
$info = Branch::findById($id);
if (!$info) {
$this->pageError('param');
}
$this->view->setVars(['info' => $info, 'formparams' => ['event' => 'edit', 'action' => \Func\url('/branch/edit')]]);
$this->view->pick('branch/add');
}
开发者ID:Crocodile26,项目名称:php-1,代码行数:30,代码来源:BranchController.php
示例18: getPostPage
public function getPostPage()
{
$obj = new BaseController();
$campusid = $this->getDevice();
if ($campusid == 0) {
$countryname = $obj->getCountryName();
if ($countryname == 'NONE') {
return Redirect::route('selectcampus-get');
} else {
//check whether the country name exists inthe db
$locationcountry = Country::where('name', '=', $countryname);
if ($locationcountry->count()) {
$locationcountrycode = $locationcountry->first()->code;
$locationcountrycode = strtolower($locationcountrycode);
return Redirect::route('selectcountryid', $locationcountrycode);
} else {
return Redirect::route('selectcampus-get');
}
}
}
$college = Institution::whereHas('Branch', function ($query) use($campusid) {
$query->where('id', '=', $campusid);
})->first();
View::share('college', $college);
$mycampus = Branch::where('id', '=', $campusid)->first();
View::share('mycampus', $mycampus);
if (Auth::user()) {
return View::make('member.post');
}
return View::make('guest.post');
}
开发者ID:franqq,项目名称:squeeber,代码行数:31,代码来源:PostController.php
示例19: getCommits
/**
* @param Branch $branch
*
* @return Commit[]
*/
public function getCommits(Branch $branch)
{
exec(sprintf('git log --pretty=format:"%s" %s', self::PRETTY_FORMAT_STRING, $branch->getName()), $output);
$commits = [];
$commitData = [];
foreach ($output as $line) {
if (empty($line)) {
$commits[$commitData['H']] = new Commit(new Hash($commitData['H']), new User($commitData['aN'], $commitData['aE']), new \DateTime($commitData['ai']), new User($commitData['cN'], $commitData['cE']), new \DateTime($commitData['ci']), $commitData['s']);
continue;
}
if (false === strpos($line, ':')) {
continue;
}
list($key, $value) = explode(':', $line, 2);
$commitData[$key] = $value;
}
return $commits;
}
开发者ID:phpeople,项目名称:git-log-parser,代码行数:23,代码来源:GitLogParser.php
示例20: synchronize
/**
* @static
* @param GitCommand $gitCommand
* @param Repository $repository
* @param Branch $branch
* @param bool $deleteOnly
* @return void
*/
public static function synchronize(GitCommand $gitCommand, Repository $repository, Branch $branch, $deleteOnly = false)
{
$branchGit = $gitCommand->getNoMergedBranchInfos($repository->getGitDir(), $branch->getBaseBranchName(), $branch->getName());
$branchModel = BranchQuery::create()->filterByRepositoryId($repository->getId())->filterByName($branch->getName())->findOne();
if ($branchModel) {
if (is_null($branchGit)) {
$branchModel->delete();
} elseif (!$branchModel->getIsBlacklisted() && !$deleteOnly) {
$lastSynchronizationCommit = $branchModel->getLastCommit();
$branchModel->setCommitReference($branchGit['commit_reference']);
$branchModel->setLastCommit($branchGit['last_commit']);
$branchModel->setLastCommitDesc($branchGit['last_commit_desc']);
$branchModel->save();
return FilePeer::synchronize($gitCommand, $branchModel, $lastSynchronizationCommit);
}
}
return 0;
}
开发者ID:ratibus,项目名称:Crew,代码行数:26,代码来源:BranchPeer.php
注:本文中的Branch类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论