Ejemplo n.º 1
0
 /**
  * @param  OrderedTable  $row
  * @param  string[]      $input
  * @param  UserTable     $user
  * @param  stdClass      $model
  * @param  PluginTable   $plugin
  */
 static function showBlogEdit($row, $input, $user, $model, $plugin)
 {
     global $_CB_framework, $_PLUGINS;
     cbValidator::loadValidation();
     $blogMode = $plugin->params->get('blog_mode', 1);
     $pageTitle = $row->get('id') ? CBTxt::T('Edit Blog') : CBTxt::T('Create Blog');
     $cbModerator = Application::User((int) $user->get('id'))->isGlobalModerator();
     $_CB_framework->setPageTitle($pageTitle);
     $_CB_framework->appendPathWay(htmlspecialchars(CBTxt::T('Blogs')), $_CB_framework->userProfileUrl($row->get('user', $user->get('id')), true, 'cbblogsTab'));
     $_CB_framework->appendPathWay(htmlspecialchars($pageTitle), $_CB_framework->pluginClassUrl($plugin->element, true, $row->get('id') ? array('action' => 'blogs', 'func' => 'edit', 'id' => (int) $row->get('id')) : array('action' => 'blogs', 'func' => 'new')));
     initToolTip();
     $return = '<div class="blogEdit">' . '<form action="' . $_CB_framework->pluginClassUrl($plugin->element, true, array('action' => 'blogs', 'func' => 'save', 'id' => (int) $row->get('id'))) . '" method="post" enctype="multipart/form-data" name="blogForm" id="blogForm" class="cb_form blogForm form-auto cbValidation">' . ($pageTitle ? '<div class="blogsTitle page-header"><h3>' . $pageTitle . '</h3></div>' : null);
     if ($cbModerator || !$plugin->params->get('blog_approval', 0)) {
         $return .= '<div class="cbft_select cbtt_select form-group cb_form_line clearfix">' . '<label for="published" class="col-sm-3 control-label">' . CBTxt::Th('Published') . '</label>' . '<div class="cb_field col-sm-9">' . $input['published'] . getFieldIcons(1, 0, null, CBTxt::T('Select publish status of the blog. Unpublished blogs will not be visible to the public.')) . '</div>' . '</div>';
     }
     if ($plugin->params->get('blog_category_config', 1) || $cbModerator) {
         $return .= '<div class="cbft_select cbtt_select form-group cb_form_line clearfix">' . '<label for="category" class="col-sm-3 control-label">' . CBTxt::Th('Category') . '</label>' . '<div class="cb_field col-sm-9">' . $input['category'] . getFieldIcons(1, 0, null, CBTxt::T('Select blog category. Select the category that best describes your blog.')) . '</div>' . '</div>';
     }
     if ($plugin->params->get('blog_access_config', 1) || $cbModerator) {
         $return .= '<div class="cbft_select cbtt_select form-group cb_form_line clearfix">' . '<label for="access" class="col-sm-3 control-label">' . CBTxt::Th('Access') . '</label>' . '<div class="cb_field col-sm-9">' . $input['access'] . getFieldIcons(1, 0, null, CBTxt::T('Select access to blog; all groups above that level will also have access to the blog.')) . '</div>' . '</div>';
     }
     $return .= '<div class="cbft_text cbtt_input form-group cb_form_line clearfix">' . '<label for="title" class="col-sm-3 control-label">' . CBTxt::Th('Title') . '</label>' . '<div class="cb_field col-sm-9">' . $input['title'] . getFieldIcons(1, 1, null, CBTxt::T('Input blog title. This is the title that will distinguish this blog from others. Suggested to input something unique and intuitive.')) . '</div>' . '</div>';
     if (in_array($blogMode, array(1, 2))) {
         $return .= '<div class="cbft_textarea cbtt_textarea form-group cb_form_line clearfix">' . '<label for="blog_intro" class="col-sm-3 control-label">' . ($blogMode == 1 ? CBTxt::T('Blog Intro') : CBTxt::T('Blog')) . '</label>' . '<div class="cb_field col-sm-9">' . $input['blog_intro'] . getFieldIcons(1, 0, null, CBTxt::T('Input HTML supported blog intro contents. Suggested to use minimal but well formatting for easy readability.')) . '</div>' . '</div>';
     }
     if (in_array($blogMode, array(1, 3))) {
         $return .= '<div class="cbft_textarea cbtt_textarea form-group cb_form_line clearfix">' . '<label for="blog_full" class="col-sm-3 control-label">' . ($blogMode == 1 ? CBTxt::T('Blog Full') : CBTxt::T('Blog')) . '</label>' . '<div class="cb_field col-sm-9">' . $input['blog_full'] . getFieldIcons(1, 0, null, CBTxt::T('Input HTML supported blog contents. Suggested to use minimal but well formatting for easy readability.')) . '</div>' . '</div>';
     }
     if ($cbModerator) {
         $return .= '<div class="cbft_text cbtt_input form-group cb_form_line clearfix">' . '<label for="user" class="col-sm-3 control-label">' . CBTxt::T('Owner') . '</label>' . '<div class="cb_field col-sm-9">' . $input['user'] . getFieldIcons(1, 1, null, CBTxt::T('Input owner of blog as single integer user_id.')) . '</div>' . '</div>';
     }
     if ($plugin->params->get('blog_captcha', 0) && !$cbModerator) {
         $_PLUGINS->loadPluginGroup('user');
         $captcha = $_PLUGINS->trigger('onGetCaptchaHtmlElements', array(false));
         if (!empty($captcha)) {
             $captcha = $captcha[0];
             $return .= '<div class="form-group cb_form_line clearfix">' . '<label class="col-sm-3 control-label">' . CBTxt::Th('Captcha') . '</label>' . '<div class="cb_field col-sm-9">' . (isset($captcha[0]) ? $captcha[0] : null) . '</div>' . '</div>' . '<div class="form-group cb_form_line clearfix">' . '<div class="cb_field col-sm-offset-3 col-sm-9">' . str_replace('inputbox', 'form-control', isset($captcha[1]) ? $captcha[1] : null) . getFieldIcons(1, 1, null) . '</div>' . '</div>';
         }
     }
     $return .= '<div class="form-group cb_form_line clearfix">' . '<div class="col-sm-offset-3 col-sm-9">' . '<input type="submit" value="' . htmlspecialchars($row->get('id') ? CBTxt::T('Update Blog') : CBTxt::T('Create Blog')) . '" class="blogsButton blogsButtonSubmit btn btn-primary"' . cbValidator::getSubmitBtnHtmlAttributes() . ' />&nbsp;' . ' <input type="button" value="' . htmlspecialchars(CBTxt::T('Cancel')) . '" class="blogsButton blogsButtonCancel btn btn-default" onclick="if ( confirm( \'' . addslashes(CBTxt::T('Are you sure you want to cancel? All unsaved data will be lost!')) . '\' ) ) { location.href = \'' . $_CB_framework->userProfileUrl($row->get('user', $user->get('id')), false, 'cbblogsTab') . '\'; }" />' . '</div>' . '</div>' . cbGetSpoofInputTag('plugin') . '</form>' . '</div>';
     echo $return;
 }
Ejemplo n.º 2
0
	public function __construct( $db = null )
	{
		parent::__construct( $db, '#__k2_categories', 'id' );
	}
Ejemplo n.º 3
0
 /**
  * Generic check for whether dependancies exist for this object in the db schema
  *
  * @param  int  $oid  key index (only int supported here)
  * @return boolean
  */
 function canDelete($oid = null)
 {
     if ($oid === null) {
         $k = $this->_tbl_key;
         $oid = $this->{$k};
     }
     if ($this->sys) {
         $this->_error = CBTxt::T('System tabs cannot be deleted!');
         return false;
     }
     if ($this->pluginid) {
         $plugin = new PluginTable($this->_db);
         if ($plugin->load($this->pluginid)) {
             $this->_error = CBTxt::T('Plugin tabs cannot be deleted!');
             return false;
         }
     }
     // Check if tab still has fields:
     $fieldObject = new FieldTable($this->_db);
     if ($fieldObject->countFieldsOfTab($oid)) {
         $this->_error = CBTxt::T('Tabs with fields cannot be deleted!');
         return false;
     }
     return parent::canDelete($oid);
 }
Ejemplo n.º 4
0
	/**
	 * Deletes this record (no checks)
	 * Delete method for fields deleting also fieldvalues, and the data column(s) in the comprofiler table.
	 *
	 * @param  int      $oid   Key id of row to delete (otherwise it's the one of $this)
	 * @return boolean         TRUE if OK, FALSE if error
	 */
	public function delete( $oid = null ) {
		$k							=	$this->_tbl_key;

		if ( $oid ) {
			$this->$k				=	(int) $oid;
		}

		$fieldHandler				=	new cbFieldHandler();

		$result						=	$fieldHandler->adaptSQL( $this, 'drop' );

		if ( $result ) {
			//delete each field value related to a field
			$rowFieldValues			=	new FieldValueTable( $this->_db );
			$result					=	$rowFieldValues->updateFieldValues( $this->$k, array() );

			//Now delete the field itself without deleting the user data, preserving it for reinstall
			//$this->deleteColumn( $this->table, $this->name );	// this would delete the user data
			$result					=	parent::delete( $this->$k ) && $result;
		}

		return $result;
	}
Ejemplo n.º 5
0
	public function __construct( $db = null )
	{
		parent::__construct( $db, '', 'id' );
	}
Ejemplo n.º 6
0
	/**
	 * @param null|int $id
	 * @return bool
	 */
	public function delete( $id = null )
	{
		global $_PLUGINS;

		$_PLUGINS->trigger( 'activity_onBeforeDeleteEmote', array( &$this ) );

		if ( ! parent::delete( $id ) ) {
			return false;
		}

		$_PLUGINS->trigger( 'activity_onAfterDeleteEmote', array( $this ) );

		return true;
	}
Ejemplo n.º 7
0
 /**
  * @param  OrderedTable  $row
  * @param  UserTable     $user
  * @param  stdClass      $model
  * @param  PluginTable   $plugin
  */
 static function showBlog($row, $user, $model, $plugin)
 {
     global $_CB_framework;
     $_CB_framework->setPageTitle($row->get('title'));
     $_CB_framework->appendPathWay(htmlspecialchars(CBTxt::T('Blogs')), $_CB_framework->userProfileUrl($row->get('user', $user->get('id')), true, 'cbblogsTab'));
     $_CB_framework->appendPathWay(htmlspecialchars($row->get('title')), $_CB_framework->pluginClassUrl($plugin->element, true, array('action' => 'blogs', 'func' => 'show', 'id' => (int) $row->get('id'))));
     $cbUser =& CBuser::getInstance((int) $row->get('user'), false);
     $return = '<div class="blowShow">' . '<div class="blogsTitle page-header"><h3>' . $row->get('title') . ' <small>' . CBTxt::T('WRITTEN_BY_BLOG_AUTHOR', 'Written by [blog_author]', array('[blog_author]' => $cbUser->getField('formatname', null, 'html', 'none', 'list', 0, true))) . '</small></h3></div>' . '<div class="blogsHeader well well-sm">' . CBTxt::T('CATEGORY_CATEGORY', 'Category: [category]', array('[category]' => $row->get('category'))) . ' &nbsp;/&nbsp; ' . CBTxt::T('CREATED_CREATED', 'Created: [created]', array('[created]' => cbFormatDate($row->get('created')))) . ($row->get('modified') && $row->get('modified') != '0000-00-00 00:00:00' ? ' &nbsp;/&nbsp; ' . CBTxt::T('MODIFIED_MODIFIED', 'Modified: [modified]', array('[modified]' => cbFormatDate($row->get('modified')))) : null) . '</div>' . '<div class="blogsText">' . $row->get('blog_intro') . $row->get('blog_full') . '</div>' . '</div>';
     echo $return;
 }
Ejemplo n.º 8
0
	/**
	 * @param  OrderedTable  $row
	 * @param  string[]      $input
	 * @param  UserTable     $user
	 * @param  stdClass      $model
	 * @param  PluginTable   $plugin
	 */
	static function showBlogEdit( $row, $input, $user, /** @noinspection PhpUnusedParameterInspection */ $model, $plugin )
	{
		global $_CB_framework, $_PLUGINS, $_LANG;

		cbValidator::loadValidation();

		$blogMode			=	$plugin->params->get( 'hangout_mode', 1 );
		$pageTitle			=	( $row->get( 'id' ) ? $_LANG['Edit Hangout'] : $_LANG['Create Hangout'] );
		$cbModerator		=	Application::User( (int) $user->get( 'id' ) )->isGlobalModerator();

		$_CB_framework->setPageTitle( $pageTitle );
		$_CB_framework->appendPathWay( htmlspecialchars( $_LANG['Hangout'] ), $_CB_framework->userProfileUrl( $row->get( 'user', $user->get( 'id' ) ), true, 'cbhangoutTab' ) );
		$_CB_framework->appendPathWay( htmlspecialchars( $pageTitle ), $_CB_framework->pluginClassUrl( $plugin->element, true, ( $row->get( 'id' ) ? array( 'action' => 'hangout', 'func' => 'edit', 'id' => (int) $row->get( 'id' ) ) : array( 'action' => 'hangout', 'func' => 'new' ) ) ) );

		initToolTip();

		$return				=	'<div class="blogEdit">'
							.		'<form action="' . $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'hangout', 'func' => 'save', 'id' => (int) $row->get( 'id' ) ) ) . '" method="post" enctype="multipart/form-data" name="blogForm" id="blogForm" class="cb_form blogForm form-auto cbValidation">'
							.			( $pageTitle ? '<div class="blogsTitle page-header"><h3>' . $pageTitle . '</h3></div>' : null );

		if ( $cbModerator || ( ! $plugin->params->get( 'hangout_approval', 0 ) ) ) {
			$return			.=			'<div class="cbft_select cbtt_select form-group cb_form_line clearfix">'
							.				'<label for="published" class="col-sm-3 control-label">' . CBTxt::Th( 'Published' ) . '</label>'
							.				'<div class="cb_field col-sm-9">'
							.					$input['published']
							.					getFieldIcons( 1, 0, null, '' )
							.				'</div>'
							.			'</div>';
		}

		if ( $plugin->params->get( 'hangout_category_config', 1 ) || $cbModerator ) {
			$return			.=			'<div class="cbft_select cbtt_select form-group cb_form_line clearfix">'
							.				'<label for="category" class="col-sm-3 control-label">' . CBTxt::Th( 'Category' ) . '</label>'
							.				'<div class="cb_field col-sm-9">'
							.					$input['category']
							.					getFieldIcons( 1, 0, null, '' )
							.				'</div>'
							.			'</div>';
		}

		if ( $plugin->params->get( 'hangout_access_config', 1 ) || $cbModerator ) {
			$return			.=			'<div class="cbft_select cbtt_select form-group cb_form_line clearfix">'
							.				'<label for="access" class="col-sm-3 control-label">' . CBTxt::Th( 'Access' ) . '</label>'
							.				'<div class="cb_field col-sm-9">'
							.					$input['access']
							.					getFieldIcons( 1, 0, null, '' )
							.				'</div>'
							.			'</div>';
		}

		$return				.=			'<div class="cbft_text cbtt_input form-group cb_form_line clearfix">'
							.				'<label for="title" class="col-sm-3 control-label">' . CBTxt::Th( 'Title' ) . '</label>'
							.				'<div class="cb_field col-sm-9">'
							.					$input['title']
							.					getFieldIcons( 1, 1, null, '' )
							.				'</div>'
							.			'</div>';

		if ( in_array( $blogMode, array( 1, 2 ) ) ) {
			$return			.=			'<div class="cbft_textarea cbtt_textarea form-group cb_form_line clearfix">'
							.				'<label for="hangout_intro" class="col-sm-3 control-label">' . ( $blogMode == 1 ? $_LANG['Text intro'] : $_LANG['Text intro'] ) . '</label>'
							.				'<div class="cb_field col-sm-9">'
							.					$input['hangout_intro']
							.					getFieldIcons( 1, 0, null, '' )
							.				'</div>'
							.			'</div>';
		}

		if ( in_array( $blogMode, array( 1, 3 ) ) ) {
			$return			.=			'<div class="cbft_textarea cbtt_textarea form-group cb_form_line clearfix">'
							.				'<label for="hangout_full" class="col-sm-3 control-label">' . ( $blogMode == 1 ? $_LANG['Text full'] : $_LANG['Text full'] ) . '</label>'
							.				'<div class="cb_field col-sm-9">'
							.					$input['hangout_full']
							.					getFieldIcons( 1, 0, null, '' )
							.				'</div>'
							.			'</div>';
                        
                        $return			.=			'<div class="cbft_text cbtt_input form-group cb_form_line clearfix">'
							.				'<label for="title" class="col-sm-3 control-label">' . $_LANG['Price'] . '</label>'
							.				'<div class="cb_field col-sm-9">'
							.					$input['price']
							.					getFieldIcons( 1, 0, null, $_LANG['Input price']  )
							.				'</div>'
							.			'</div>';
                        
		}

		if ( $cbModerator ) {
			$return			.=			'<div class="cbft_text cbtt_input form-group cb_form_line clearfix">'
							.				'<label for="user" class="col-sm-3 control-label">' . CBTxt::T( 'Owner' ) . '</label>'
							.				'<div class="cb_field col-sm-9">'
							.					$input['user']
							.					getFieldIcons( 1, 1, null, '' )
							.				'</div>'
							.			'</div>';
		}

		if ( $plugin->params->get( 'hangout_captcha', 0 ) && ( ! $cbModerator ) ) {
			$_PLUGINS->loadPluginGroup( 'user' );

			$captcha		=	$_PLUGINS->trigger( 'onGetCaptchaHtmlElements', array( false ) );

			if ( ! empty( $captcha ) ) {
				$captcha	=	$captcha[0];

				$return		.=			'<div class="form-group cb_form_line clearfix">'
							.				'<label class="col-sm-3 control-label">' . CBTxt::Th( 'Captcha' ) . '</label>'
							.				'<div class="cb_field col-sm-9">'
							.					( isset( $captcha[0] ) ? $captcha[0] : null )
							.				'</div>'
							.			'</div>'
							.			'<div class="form-group cb_form_line clearfix">'
							.				'<div class="cb_field col-sm-offset-3 col-sm-9">'
							.					str_replace( 'inputbox', 'form-control', ( isset( $captcha[1] ) ? $captcha[1] : null ) )
							.					getFieldIcons( 1, 1, null )
							.				'</div>'
							.			'</div>';
			}
		}

		$return				.=			'<div class="form-group cb_form_line clearfix">'
							.				'<div class="col-sm-offset-3 col-sm-9">'
							.					'<input type="submit" value="' . htmlspecialchars( ( $row->get( 'id' ) ? $_LANG["Update Hangout"] : $_LANG["Create Hangout"] ) ) . '" class="blogsButton blogsButtonSubmit btn btn-primary"' . cbValidator::getSubmitBtnHtmlAttributes() . ' />&nbsp;'
							.					' <input type="button" value="' . htmlspecialchars( CBTxt::T( 'Cancel' ) ) . '" class="blogsButton blogsButtonCancel btn btn-default" onclick="if ( confirm( \'' . addslashes( CBTxt::T( 'Are you sure you want to cancel? All unsaved data will be lost!' ) ) . '\' ) ) { location.href = \'' . $_CB_framework->userProfileUrl( $row->get( 'user', $user->get( 'id' ) ), false, 'cbhangoutTab' ) . '\'; }" />'
							.				'</div>'
							.			'</div>'
							.			cbGetSpoofInputTag( 'plugin' )
							.		'</form>'
							.	'</div>';

		echo $return;
	}
Ejemplo n.º 9
0
	/**
	 * @param  OrderedTable  $row
	 * @param  UserTable     $user
	 * @param  stdClass      $model
	 * @param  PluginTable   $plugin
	 */
	static function showconsultation( $row, $user, /** @noinspection PhpUnusedParameterInspection */ $model, $plugin, $bids )
	{
		global $_CB_framework;

		$_CB_framework->setPageTitle( $row->get( 'title' ) );
		$_CB_framework->appendPathWay( htmlspecialchars( CBTxt::T( 'consultations' ) ), $_CB_framework->userProfileUrl( $row->get( 'user', $user->get( 'id' ) ), true, 'cbconsultationsTab' ) );
		$_CB_framework->appendPathWay( htmlspecialchars( $row->get( 'title' ) ), $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'consultations', 'func' => 'show', 'id' => (int) $row->get( 'id' ) ) ) );

		$cbUser			=&	CBuser::getInstance( (int) $row->get( 'user' ), false );

		$return			=	'<div class="blowShow">'
						.		'<div class="consultationsTitle page-header"><h3>' . $row->get( 'title' ) . ' <small>' . CBTxt::T( 'WRITTEN_BY_consultation_AUTHOR', 'Written by [consultation_author]', array( '[consultation_author]' => $cbUser->getField( 'formatname', null, 'html', 'none', 'list', 0, true ) ) ) . '</small></h3></div>'
						.		'<div class="consultationsHeader well well-sm">'
						.			CBTxt::T( 'CATEGORY_CATEGORY', 'Category: [category]', array( '[category]' => $row->get( 'category' ) ) )
						.			' &nbsp;/&nbsp; ' . CBTxt::T( 'CREATED_CREATED', 'Created: [created]', array( '[created]' => cbFormatDate( $row->get( 'created' ) ) ) )
						.			( $row->get( 'modified' ) && ( $row->get( 'modified' ) != '0000-00-00 00:00:00' ) ? ' &nbsp;/&nbsp; ' . CBTxt::T( 'MODIFIED_MODIFIED', 'Modified: [modified]', array( '[modified]' => cbFormatDate( $row->get( 'modified' ) ) ) ) : null )
						.		'</div>'
						.		'<div class="consultationsText">' . $row->get( 'consultation_intro' ) . $row->get( 'consultation_full' ) . '</div>'
						.	'</div>';
    if($bids!=null){
      $return .= '<script >
          window.___gcfg = {
                  lang: \'ru\',
                          parsetags: \'onload\'
                              };
                              </script>

<script src="https://apis.google.com/js/platform.js" async defer></script>
';
      $return .= '<h2>Ставки</h2>';
      if(empty($bids)){
        $return .= "Нет ставок";
      }else{
        $return .= '<table cellspacing="5" class="consultationsContainer table table-hover table-responsive">';
        $return .= '<tr><th>Дата</th><th>Пользователь</th><th>e-mail</th><th>Цена</th><th></th></tr>';
        foreach($bids as $key=>$value){
          $return .='<tr>';
          $return .= '<td>'.$value->bid_date.'</td>';
          $return .= '<td>'.$value->name.'</td>';
          $return .= '<td>'.$value->email.'</td>';
          $return .= '<td>$'.$value->bid_price.'</td>';
          $return .= '<td>';
          if($key==0){
            //Old version was using Goolge Hangouts for communications.
            //$return .= '<g:hangout render="createhangout" hangout_type="normal" topic="'.addslashes($row->get('title')).'"
            //           invites="[{ id : \''.$value->email.'\', invite_type : \'EMAIL\' }]">
            //           </g:hangout>';
            //New version is using CloudInterpreter
            $return .= '<a target="_blank" href="http://dev.cloudinterpreter.com:8901/'.md5($row->get('id')).'"><button class="btn btn-success">Начать консультацию</button></a>';
          }
          $return .= '</td>';
          $return .='</tr>';
        }
        $return .= '</table>';
      }
		}
    echo $return;
	}
Ejemplo n.º 10
0
 /**
  * Copies this record (no checks) (tab and its fields)
  *
  * @param  null|TableInterface|self  $object  The object being copied otherwise create new object and add $this
  * @return self|boolean                       OBJECT: The new object copied successfully, FALSE: Failed to copy
  */
 public function copy($object = null)
 {
     if ($object === null) {
         $object = clone $this;
     }
     // TODO: This algorithm below to determine the new name could be factored out as reusable:
     // Grab index of list from lists with same title
     $query = 'SELECT ' . $this->_db->NameQuote('title') . "\n FROM " . $this->_db->NameQuote($this->_tbl) . "\n WHERE " . $this->_db->NameQuote('title') . " REGEXP " . $this->_db->Quote('^' . preg_quote($object->title) . '[0-9]*$') . "\n ORDER BY " . $this->_db->NameQuote('title');
     $this->_db->setQuery($query);
     $titles = $this->_db->loadResultArray();
     $count = count($titles);
     // Only increment if there's something to increment as the title could be changed before copy is called, which would be a 0 count:
     if ($count) {
         // Increment index by 1 based off similar list title count:
         $index = $count + 1;
         // Loop through and make sure the index is unique; if not keep incrementing until it is:
         do {
             $changed = false;
             foreach ($titles as $v) {
                 if ($v == $object->title . $index) {
                     $index++;
                     $changed = true;
                 }
             }
         } while ($changed);
         $object->title = $object->title . ' (' . $index . ')';
     }
     return parent::copy($object);
 }
Ejemplo n.º 11
0
	/**
	 * @param null|int $id
	 * @return bool
	 */
	public function delete( $id = null )
	{
		global $_CB_framework, $_PLUGINS;

		$_PLUGINS->trigger( 'gj_onBeforeDeleteCategory', array( &$this ) );

		if ( ! parent::delete( $id ) ) {
			return false;
		}

		// Delete groups in this category:
		$query				=	'SELECT *'
							.	"\n FROM " . $this->getDbo()->NameQuote( '#__groupjive_groups' )
							.	"\n WHERE " . $this->getDbo()->NameQuote( 'category' ) . " = " . (int) $this->get( 'id' );
		$this->getDbo()->setQuery( $query );
		$groups				=	$this->getDbo()->loadObjectList( null, '\CB\Plugin\GroupJive\Table\GroupTable', array( $this->getDbo() ) );

		/** @var GroupTable[] $groups */
		foreach ( $groups as $group ) {
			$group->delete();
		}

		// Delete canvas and logo:
		if ( $this->get( 'canvas' ) || $this->get( 'logo' ) ) {
			CBGroupJive::deleteDirectory( $_CB_framework->getCfg( 'absolute_path' ) . '/images/comprofiler/plug_cbgroupjive/' . (int) $this->get( 'id' ) );
		}

		$_PLUGINS->trigger( 'gj_onAfterDeleteCategory', array( $this ) );

		return true;
	}
Ejemplo n.º 12
0
	/**
	 * Copies this record (no checks)
	 * canCopy should be called first to check if a copy is possible.
	 *
	 * @param  null|TableInterface|self  $object  The object being copied otherwise create new object and add $this
	 * @return self|boolean                       OBJECT: The new object copied successfully, FALSE: Failed to copy
	 */
	public function copy( $object = null )
	{
		if ( $object === null ) {
			$object		=	clone $this;
		}

		if ( $object->get( 'system' ) ) {
			$object->set( 'system', 0 );
		}

		return parent::copy( $object );
	}
Ejemplo n.º 13
0
	/**
	 * @param  OrderedTable  $row
	 * @param  UserTable     $user
	 * @param  stdClass      $model
	 * @param  PluginTable   $plugin
	 */
	static function showBlog( $row, $user, /** @noinspection PhpUnusedParameterInspection */ $model, $plugin, $usrs)
	{
		global $_CB_framework, $_LANG;

		$_CB_framework->setPageTitle( $row->get( 'title' ) );
		$_CB_framework->appendPathWay( htmlspecialchars( $_LANG['Hangout'] ), $_CB_framework->userProfileUrl( $row->get( 'user', $user->get( 'id' ) ), true, 'cbhangoutTab' ) );
		$_CB_framework->appendPathWay( htmlspecialchars( $row->get( 'title' ) ), $_CB_framework->pluginClassUrl( $plugin->element, true, array( 'action' => 'hangout', 'func' => 'show', 'id' => (int) $row->get( 'id' ) ) ) );

		$cbUser			=&	CBuser::getInstance( (int) $row->get( 'user' ), false );
                $join_button = '';
                if($row->get( 'user' ) == $user->get( 'id' )){
                    
                    $emails_str = '';
                    $subscrStr = '';
                    if($usrs){
                        $subscrStr .= '<div>' . $_LANG['Subscribers'] . ':<br />';
                        $usrCount = 0;
                        foreach ($usrs as $value) {
                            $cbUserObj			=&	CBuser::getInstance( (int) $value, false );
                            
                            $email = CBuser::getUserDataInstance($value)->get('email');
                            if($email){
                                
                                if($usrCount > 0){
                                    $emails_str .= ',';
                                    $subscrStr .= ', ';
                                }
                                $subscrStr .= $cbUserObj->getField( 'formatname', null, 'html', 'none', 'list', 0, true );
                                $subscrStr .= ' ('.$email.')';
                                $emails_str .= '{ id : \''.$email.'\', invite_type : \'EMAIL\' }';
                                $usrCount ++;
                            }
                            
                        }
                        $subscrStr .= '</div>';
                    }
                    
                    $curlang = $_CB_framework->getCfg( 'lang' ) == 'russian' ? 'ru' : 'en';
                    
                    $join_button = '<script >'
                                .'window.___gcfg = {'
                                    .'lang: \''.$curlang.'\','
                                    .'parsetags: \'onload\''
                                .'};'
                            .'</script>'
                            .'<script src="https://apis.google.com/js/platform.js" async defer></script>'
                            //.'<style>.begin_conf{cursor:pointer; border:1px solid #333; display:inline-block; }</style>'
                            .'<span class="begin_conf"><g:hangout render="createhangout" hangout_type="onair" topic="'.$row->get( 'title' ).'"
                                            invites="['.$emails_str.']">
                                 </g:hangout></span>'.$subscrStr;
                    
                    
                    
                }elseif($user->get( 'id' )){
                    if($row->price > 0){
                        $link = '#';
                        $link_text = $_LANG['Pay']." ".$row->price;
                    }else{
                        $link = cbSef( 'index.php?option=com_comprofiler&view=pluginclass&plugin=cbhangout&action=hangout&func=joinconf&id=' . (int) $row->id, true );
                        $link_text = $_LANG['Join'];
                    }
                    
                    if(count($usrs) && in_array($user->get( 'id' ), $usrs)){
                        $join_button = $_LANG['You allready joined conference'];
                    }else{
                        $join_button = '<a href="'.$link.'" /><input type="button" value="'.$link_text.'" class="btn btn-primary"/></a>';

                    }
                    
                }else{
                    $reg_link = $_CB_framework->viewUrl( 'registers', true, null, 'html', 0 );
                    $join_button = $_LANG['Need to register']
                            .'- <a href="'.$reg_link.'">'
                            .$_LANG['Register']
                            .'</a>';
                }
                
                
		$return			=	'<div class="blowShow">'
						.		'<div class="blogsTitle page-header"><h3>' . $row->get( 'title' ) . ' <small>' . CBTxt::T( 'WRITTEN_BY_BLOG_AUTHOR', 'Written by [blog_author]', array( '[blog_author]' => $cbUser->getField( 'formatname', null, 'html', 'none', 'list', 0, true ) ) ) . '</small></h3></div>'
						.		'<div class="blogsHeader well well-sm">'
						.			CBTxt::T( 'CATEGORY_CATEGORY', 'Category: [category]', array( '[category]' => $row->get( 'category' ) ) )
						.			' &nbsp;/&nbsp; ' . CBTxt::T( 'CREATED_CREATED', 'Created: [created]', array( '[created]' => cbFormatDate( $row->get( 'created' ) ) ) )
						.			( $row->get( 'modified' ) && ( $row->get( 'modified' ) != '0000-00-00 00:00:00' ) ? ' &nbsp;/&nbsp; ' . CBTxt::T( 'MODIFIED_MODIFIED', 'Modified: [modified]', array( '[modified]' => cbFormatDate( $row->get( 'modified' ) ) ) ) : null )
                                                .                       ' &nbsp;/&nbsp; ' . $_LANG['Price'] . ' : ' .$row->get( 'price' )   
						.		'</div>'
						.		'<div class="blogsText">' . $row->get( 'hangout_intro' ) . $row->get( 'hangout_full' ) . '</div>'
						.	'</div>'
                                                .   '<div>'
                                                .       $join_button
                                                .   '</div>';

		echo $return;
	}