Sunday, 25 June 2017

73.group

  1 2
    4 3
    1 2
    ans
    1 2
    4 3
         $countPropertyRequirementVillaData  = count($propertyRequirementVillaData);

   $roomappartmenthouselocationselect = $propertyRequirementTable->select()
                    ->setIntegrityCheck(false)
                    ->from(array('property_req'=>'engine4_property_requirement',))
                    ->joinLeft(array('state'=>'engine4_state_list',),'state.state_id=property_req.state_id',array('state'))                                
                    ->joinLeft(array('city'=>'engine4_city_list',),'city.city_id=property_req.city_id',array('city'))
                    ->where('property_req.tenant_id = ?', $data['user_id'])
                    ->where('(property_req.housing_type = ?', 'House' )
->orWhere('property_req.housing_type = ?', 'Apartment')
->orWhere('property_req.housing_type = ?)', 'Room')
->group(array('city.city_id'))
;

72.count in select query

$select   =   $table->select()
                        ->setIntegrityCheck(false)
                        ->from(array('user'=>'engine4_users',))
                        ->columns(array('count_property' => new Zend_Db_Expr('COUNT(user.user_id)')))                      
                        ->joinLeft(array('search_field'=>'engine4_user_fields_search'),'search_field.item_id=user.user_id',null)                                            
                        ->joinLeft(array('plist'=>'engine4_property_list',),'plist.property_owner_id=user.user_id')                                
                        ->where('user.search=?' , 1)
                        ->where('search_field.profile_type =?' , '4')
                        ->group('user.user_id');

71.in array

eg.1
if(in_array($data['user_id'],$user_ids)){

}
eg.2
$array = array('kitchen', 'bedroom', 'living_room', 'dining_room');

if (in_array('kitchen', $array)) {
    echo 'this array contains kitchen';
}

eg3
<?php
$people = array("Peter", "Joe", "Glenn", "Cleveland");

if (in_array("Glenn", $people))
  {
  echo "Match found";
  }
else
  {
  echo "Match not found";
  }
?>

70.array push

eg.
<?php $locationofroom=[];
if(!empty($propertyRequirementVillaData))
{
foreach ($propertyRequirementVillaData as $row)
{
$Roomtotalbhk = $Roomtotalbhk.$row['no_of_rooms'].'BHK'.',';
$Roomlocation=$Roomlocation.$row['state'].','.$row['city'].',';
if(!in_array($Roomlocation,$locationofroom)){
array_push($locationofroom,$Roomlocation);
   }
}
    }
   
   
    ?>

69.social engine for loop

    <?php
     for($i=0;$i<=count($result['Appartmentlocation']);$i++)
     echo $result['Appartmentlocation'][$i];
     endforeach;

 ?>

68.pre tag

echo '<pre>'; print_r($tenantResultData); exit;

67.feed pages in social engine

app/modu/activity/widget/feed/intex.tpl
 acticity/views/scripts/_activityText

66.social engine layout

  $this->_helper->viewRenderer->setNoRender(false);
  $this->_helper->layout->setLayout('default');

to know layout page->refer corresponding controller
layout pages are saved in core folder

65.social engine menu

in dbchanged

$sql['1.1.4.19'] = "INSERT INTO `engine4_core_menuitems` (`id`, `name`, `module`, `label`, `plugin`, `params`, `menu`, `submenu`, `enabled`, `custom`, `order`) VALUES (NULL, 'core_mini_gallery', 'user', 'Gallery', 'User_Plugin_Menus', '', 'core_mini', NULL, '1', '0', '6');";



in user/plugin/menus.php
  public function onMenuInitialize_CoreMiniGallery($row)
  { 
    $viewer = Engine_Api::_()->user()->getViewer();
    
  if( $viewer->getIdentity() ) {

      return array(
        'label' => 'Gallery',
      'icon' => 'application/modules/User/externals/images/gallery.svg',
       'route' => 'album_general',
        'params' => array(
        'module' => 'album',
          'controller' => 'index',
          'action' => 'browse',
         
        )
      );
    }
    
    return false;
  }


backend-mini navigation menu
change position of menu

64.soial engine redirection

  //  return $this->_helper->redirector->gotoRoute(array('action' => 'home'), 'user_general', true);
    $this->_redirect('/members/edit/photo');

63.mobile and system



<?php
$useragent=$_SERVER['HTTP_USER_AGENT'];

$iPod = stripos($_SERVER['HTTP_USER_AGENT'],"iPod");
$iPhone = stripos($_SERVER['HTTP_USER_AGENT'],"iPhone");
$iPad = stripos($_SERVER['HTTP_USER_AGENT'],"iPad");
$Android = stripos($_SERVER['HTTP_USER_AGENT'],"Android");
$webOS = stripos($_SERVER['HTTP_USER_AGENT'],"webOS");
if( $iPod || $iPhone || $iPad || $Android) {
 $dev_type= 1; // mobile

}
else{

 $dev_type= 2; // system
}

?>

62.layout page in social engine

core/layout/scripts/default.tpl

61.show widget in social engine

<div class="generic_layout_container layout_left">
<?php
echo $this->content()->renderWidget('user.home-photo');
echo $this->content()->renderWidget('user.home-links');
?>
</div> 

60.count

if( !empty($fieldsByAlias['profile_type']) )
count($this->scheduledMeetingsData) == 0

59.location map

 <input type= "hidden" class="field" id="street_number" name="street_number"></input>
        <input  type= "hidden" class="field" id="route" name="route"></input>
        <input type= "hidden" class="field" id="locality" name="locality"></input>

        <input type= "hidden" class="field" id="administrative_area_level_1" name="administrative_area_level_1"></input>
        <input type= "hidden" class="field" id="postal_code" name="postal_code"></input>

        <input type= "hidden" class="field" id="country" name="country"></input>
        <input type= "hidden" class="field" id="latitude" name="latitude"></input>
        <input type= "hidden" class="field" id="longitude" name="longitude"></input>
<script>
jQuery('#global_page_user-signup-index #timezone-wrapper').after('<div class="pro_field_wrapper"><span class="location_text_span" style="font-weight: bold;">Location </span> <input id="pac-input" class="controls1" type="text" style="font-weight:bold;" placeholder="Location" ><div id="map" style="margin-top: 13px;"></div><div class="form-label" id="location-label">&nbsp;</div><div class="msg" style="color:red;"></div></div>');

</script>

<script>
var latitude  = 40.712784;
var longitude = -74.005941;
</script>


<script src="<?php echo $this->baseUrl(); ?>/application/modules/User/externals/scripts/autocomplete_address_googleapi.js"></script>

<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAOdWM32gJ4t6-csxQQxCVDigYfq261xi0&libraries=places&callback=initAutocomplete" async defer></script>

58.copy of page in git

eg.scp application/modules/User/externals/styles/style.css titech@192.168.1.59:/var/www/html

57.first pages of signup in social engine

user/views/script/signup/form/account.tpl
user/form/signup/Account.php
user/plugin/signup/Account.php
user/views/script/signup/form/index.tpl
app/modules/user/views/scripts/signup/index.tpl

56.for singin user

if( $viewer->getIdentity() ) {}

55.site for checking regular expression

http://rubular.com/

54.How to Create a Widget in socialengine

http://smarttips.in/how-to-create-widgets-in-socialengine/
after creating index.tpl and controller
modules ->group-> settings->content.php and editapplicationAction
content.php

array( ‘title’ => ‘Smart Widget’,

‘description’ => ‘This is a new Group smart Widget’,

‘category’ => ‘Group’,

‘type’ => ‘widget’,

‘name’ => ‘group.smartwidget’,

),

53.explode date and time

$datetime="18:4:30 08:02:2017";
$datetimearray =  explode(' ', $datetime);
echo $datetimearray['0'].'</br>';
echo $datetimearray['1'].'</br>';exit;

52.update form in controller

$values = $form->getValues();
    $tips_table =  Engine_Api::_()->getDbtable('tips', 'user');
    $tips_table->update(array('content' =>$values['content']),array('id = ?' => $id));
    

51.if there is no seprate tpl for an action use norenter in controller

$this->_helper->viewRenderer->setNoRender(true);
$this->_helper->layout->disableLayout();

50.try catch

 try{
//edit
     $UserData->tip_dismiss_time=$dismiss_time;
    $UserData->save();

     $aResult['status'] = true;
     }
     catch (Exception $e) {exit($e->getMessage());
$aResult['status'] = false;
}
echo json_encode($aResult); //to return in tpl

49.details from php to jquery(controller to tpl)

//controller
    $common_settings_table =  Engine_Api::_()->getDbtable('commonsettings', 'user'); //commonsettings-class name
$common_settings = $common_settings_table->fetchRow($common_settings_table->select()->where('type =?', 'tip_duration'));
$showtime=date("H:i:s", strtotime($dismiss_time."+".$common_settings->value."hour"));
//echo time("H:i:s");exit("1212");
$this->view->tip_dismiss_time=$common_settings->value;
//tpl
    var tip_dismiss_time='<?php echo $this->tip_dismiss_time; ?>';

48.fetch row from user table

$userTable = Engine_Api::_()->getDbtable('users', 'user');
 
    $UserData = $userTable->fetchRow($userTable->select()->where('user_id = ?', $viewerId)); 

47.viewer id -login user details

$viewer = Engine_Api::_()->user()->getViewer();
$viewerId = $viewer->getIdentity();

viewer email
     $viewer->email

46.social engine edit and insert in 1 function

public function tipdurationAction()
    {
      $common_settings_table =  Engine_Api::_()->getDbtable('commonsettings', 'user');
 $common_settings = $common_settings_table->fetchRow($common_settings_table->select()->where('type =?', 'tip_duration'));
 

     $this->view->form = $form = new User_Form_Admin_Manage_Tipduration();
     $aData =  $this->_request->getPost();
 if(!empty($aData)){
   $tip_duration = $aData['value'];
   if(empty($common_settings)){


       if($tip_duration!='')
           {
            $tips_table_insert_id =  $common_settings_table->insert(array(
                    'type'   => 'tip_duration',                  
                    'value' => $tip_duration,
                    'created_at'=> date("Y-m-d"),
                    'updated_at'=> date("Y-m-d"),
                ));
             
}

}
else
{
   $common_settings->value=$tip_duration;
   $common_settings->save();
}
        return $this->_forward('success', 'utility', 'core', array(
      'smoothboxClose' => true,
      'parentRefresh' => true,
      'format'=> 'smoothbox',
      'messages' => array('Your changes have been saved.')
          ));
    }
    }

45.listing

$tips_table =  Engine_Api::_()->getDbtable('tips', 'user');
   $tips_select = $tips_table->select();
    $tipData = $tips_table->fetchAll($tips_select);
$this->view->tipData = $tipData;
        

44.selection in social engine

$propertyRequestTable =  Engine_Api::_()->getDbtable('propertyrequest', 'user');
   $propertyReq_select = $propertyRequestTable->select()
                     ->setIntegrityCheck(false)
                      ->from(array('prequest'=>'engine4_property_request',))
                      ->joinLeft(array('plist'=>'engine4_property_list',),'plist.id=prequest.property_id',array('property_name','rental_type','granted'))  
          ->where('prequest.id = ?', $applicationRequest_id);
   $propertyRequest = $propertyRequestTable->fetchRow($propertyReq_select);

43.update in social engine

$propertyRequestTable =  Engine_Api::_()->getDbtable('propertyrequest', 'user');
   $propertyRequestData = $propertyRequestTable->fetchRow($propertyRequestTable->select()->where('id = ?', $applicationRequest_id));
        $propertyRequestData->application_view_status=1;
        $propertyRequestData->save();
        

42.adding css and js in social engine

<script src="/application/modules/User/externals/scripts/menu.js"></script>
<link rel="stylesheet" href="<?php echo $this->baseUrl(); ?>/application/modules/User/externals/styles/menu.css" type="text/css">

41.social engine button

 <a href="<?php echo $this->baseUrl().'/members/home'; ?>" >  <button type="button" id="compose-submit"><?php echo $this->translate("Back") ?></button></a>

Sunday, 18 June 2017

40.jquery onclick by function call

 <div class="save_btn_div save_btn_div_<?php echo $propertyData->id;?>"><button class="like_property like_property_<?php echo $propertyData->id;?>" onclick="Like_Property('<?php echo $propertyData->id; ?>')" property_id="<?php echo $propertyData->id; ?>" title="Save">Save</button></div>
     

  function Like_Property(id)
{
alert(id);

}

39.jquery check box value

<label><input type="radio" name="user" value="<?php echo $value[$i]['user_id'] ?>" data-displayname = "<?php echo $value[$i]['display_name'];?>" property-name="<?php echo $value['property_name'] ?>"></label>

var property_name =jQuery("input[name=user]:checked").attr("property-name");

38.dialogBox after submisssion

<div id="stantard-dialogBox" style="font-size:30px"></div>
  if(data.status == true){
 jQuery('#stantard-dialogBox').dialogBox({
autoHide: true,
time: 3000,
content: 'The application is successfully approved',
});
}

37.append html(view more link)

jQuery('.comments_viewall_'+action_id).html(' <a href="javascript:void(0)"   class="comments_Load_more comments_Load_more_'+action_id+'" action_id='+action_id+' status="view_more">View more</a>');

36.online library for boostrap and js

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>

35.Include js file in laravel

<script src="{{ url('/') }}/resources/assets/js/jquery.min.js"></script>