Share it

Bookmark and Share

Translate

Showing posts with label SocialEngine. Show all posts
Showing posts with label SocialEngine. Show all posts

Wednesday, February 27, 2013

0 Calculate Last week signup in SocialEngine Group


First create a new field in group membership table 
field name:creation_date 
type:timestamp 
default:CURRENT_TIMESTAMP
 
  Use the following code in controller 

       $subject=Engine_Api::_()->core()->getSubject('group');
       $this->view->subject=$subject;
       $oUser = new User_Model_DbTable_Users();
       $groupId = (int) $this->_getParam('id');

       //calculate lastweek joined members count
       $oSignups                    = new Group_Model_DbTable_Membership();
       $lastWeekSignups             = $oSignups->getSignups($groupId,date('Y-m-d'));
       $this->view->lastweeksignups = count($lastWeekSignups);

Use the code in model

      $oneWeekAgo  = strtotime ( '-1 week' , strtotime ($date));
      $oneWeekdate =  date ( 'Y-m-j G:i:s' , $oneWeekAgo );
     
      $oAdapter   = $this->getAdapter();
      $sSelect    = $oAdapter->select();
      $sSelect->from($this->_name,'user_id AS id');
      $sSelect->where('active = ?', 1);
      $sSelect->where('resource_approved = ?', 1);
      $sSelect->where('resource_id = ?', $groupId);
      if($date != ''):
      $sSelect->where('creation_date > ?',$oneWeekdate);
      endif;
      $aResult    = $oAdapter->fetchAll($sSelect);
      $aIds    = array();
      foreach ($aResult as $aVal) {
      $aIds[]    = $aVal['id'];
      }
      return $aIds;

Friday, February 15, 2013

0 Create a widget in socialEngine

Steps
We can create create widgets in socialengine.There is two ways to do this 1.one is that create widget as common for all modules
1.Go to the  folder  applications/widgets/
2.Create a folder and rename it as your widget name
3.Then create three files inside the above folder
    a,controller file Controller.php
    b,a tpl file index.tpl
    c, a manifest file

Controller.php
<?php

class Widget_PageBlockController extends Engine_Content_Widget_Abstract
{
  public function indexAction()
  {
    $this->view->data = $this->_getParam('data');
  }
}
index.tpl
<?php
/**
 * social engine
 *
 *Author sijo thomas
 */
?>
<div>
<?php echo $this->data ?>
</div>






Thursday, February 7, 2013

0 Friends Recommendation widget for socialEngine(Find people I may know)

 

TechnoTipworld- Tips,Tricks,Technology Copyright © 2011 - |- Template created by O Pregador - |- Powered by Blogger Templates