This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class DefaultController extends CController | |
{ | |
public $defaultAction = 'login'; | |
public function actionLogin() { | |
$this->layout = 'login'; | |
$model = new AdminLoginForm; | |
if(isset($_POST['AdminLoginForm'])) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function beforeControllerAction($controller, $action) | |
{ | |
if(parent::beforeControllerAction($controller, $action)) | |
{ | |
if($this->user->isGuest && !($controller->id == 'default' && $action->id == 'login')) { | |
$this->user->loginRequired(); | |
} | |
return true; | |
} | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class AdminLoginForm extends CFormModel | |
{ | |
public $username; | |
public $password; | |
public $rememberMe; | |
private $_identity; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="login-box"> | |
<div class="form"> | |
<?php $form=$this->beginWidget('CActiveForm', array( | |
'id'=>'login-form', | |
)); ?> | |
<?php echo $form->errorSummary($model); ?> | |
<div class="row"> | |
<?php echo $form->labelEx($model,'username'); ?> | |
<?php echo $form->textField($model,'username'); ?> | |
<?php echo $form->error($model,'username'); ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class EnumExample { | |
public static void main(String []args){ | |
testGender(Gender.FEMALE); | |
testGender(Gender.MALE); | |
} | |
public static void testGender(Gender gender) { | |
switch(gender) { | |
case FEMALE: | |
System.out.println("Female"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
_index:"index", | |
_type:"filme", | |
_id:"16855", | |
_version:1, | |
exists:true, | |
_source:{ | |
titulo_portugues:"RIO", | |
titulo_original:"Rio", | |
ano:"2011", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace AppBundle\Form\Type; | |
use Doctrine\Common\Persistence\ObjectManager; | |
use Symfony\Component\Form\AbstractType; | |
use Symfony\Component\Form\FormBuilderInterface; | |
class NomeDoSeuTypeType extends AbstractType | |
{ | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function getNumberOfPublicHolidaysForPeriod() { | |
if(!$this->numberOfPublicHolidaysInPeriod) { | |
$this->numberOfPublicHolidaysInPeriod = PublicHoliday::getNumberOfPublicHolidaysForPeriod( | |
$this->period->start_date, | |
$this->period->end_date | |
); | |
} | |
return $this->numberOfPublicHolidaysInPeriod; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class CSVAbsenceTypeCleaner extends CSVCleanerVisitor { | |
public function visit(array $row) { | |
$this->deleteRecord('HRAbsenceType', ['name' => $row['name']]); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
CRM_HRCore_Helpers_Database::printSQLResult('SELECT id, display_name, contact_type FROM civicrm_contact'); | |
// Prints something like: | |
// | id | display_name | contact_type | | |
// ------------------------------------ | |
// | 1 | S.H.I.E.L.D | Organization | | |
// | 2 | Nick Fury | Individual | | |
// | 3 | Steve Rogers | Individual | |