Bu forumu görüntüleyenler: Kayıtlı kullanıcı yok ve 1 misafir

alphauserpoint için şiirler plugini veya rule istiyoruz

İleti singlesoul » 29 Arl 2008

alphauserpoint kullanıcılara yaptıkları eylem karşılığında puan veren bir sistemdir. belirli bir puana ulaşan kullanıcıya o puan karşılığı hediye verilebilir. bu program için kullanıcılar şiir eklediğinde kendisine okuduğunda yazara puan kazandıracak bir rule istiyoruz.
Rumuz: singlesoul
Kıdemsiz Üyemiz
Durum: Offline
Kullanıcı avatarı

İleti: 50
Kayıt: 04 Kas 2008

Re: alphauserpoint için şiirler plugini veya rule istiyoruz

İleti singlesoul » 29 Arl 2008

AlphaUserPoints - How create a plugin - (Basic)

The creation of a plugin (creation of a new rule for a third component) is divided into 2 phases.

Step 1 - Inserting API in the component
This course is aimed primarily at developers or any person with a level of knowledge sufficiently advanced in PHP.

Simply insert the following API in the code component to where you want. The ideal is to follow an action that can bring items to the connected user. For example, in a component of any comments or forum, simply add the API after insertion source code of the commentary or new topic in the database.

API:

$api_AUP = JPATH_SITE.DS.'components'.DS.'com_alphauserpoints'.DS.'helper.php';
if ( file_exists($api_AUP))
{
require_once ($api_AUP);
AlphaUserPointsHelper::newpoints( 'function_name' );
}


function_name is the rule which will be used to award points to the current user (if registered and logged).
For all the rules included in AlphaUserPoints (systems), the function names are written as follows:

example: sysplgaup_newregistered for awarding points to a new registered user.

It should keep a nomage standard for plugin-third of components as follows:

plgaup_function_name

Example plgaup_newcomment or plgaup_newtopic to resume the example of the inclusion of this component API in a comment or forum.
The name of a function to award points when creating a new topic posted in the component Fireboard could be, for example, plgaup_newtopic_fb.

Step 2 - Creation XML file
It should then create a file xml to facilitate the installation of the rule in AlphaUserPoints.
5 elements need to be specified:

The name of the rule, its description, the name of the component using the rule (com_example), the function name used by the rule and if points are fixed (true or false).

<? xml version = "1.0" encoding = "utf-8"?>
<alphauserpoints type="plugin">
<rule>short name of the rule</ rule>
<description>Description of the rule</ description>
<component>com_example_component (or Exemple component)</ component>
<plugin_function>plgaup_function_name</ plugin_function>
<fixed_points>true or false</fixed_points>
</ alphauserpoints>

This XML file must be encoded in UTF-8 and then can be archived (. Zip).

Note to developers

You can find the complete documentation to insert and use this API in your components on official website author www.alphaplug.com.
Rumuz: singlesoul
Kıdemsiz Üyemiz
Durum: Offline
Kullanıcı avatarı

İleti: 50
Kayıt: 04 Kas 2008

Re: alphauserpoint için şiirler plugini veya rule istiyoruz

İleti singlesoul » 29 Arl 2008

AlphaUserPoints - API integration in a Third party component (advanced)

This documentation is priorly dedicated to developpers and anyone with a sufficient knowledge of php and joomla components development.

A plugin creation (new rule creation for a 3rd party component) is done in 2 steps.

Step1 - API insertion in a component

Just insert the following API in the component code where needed. The best is to make it follow a user action that could give the users some points or take some. For exemple in a comment system component or in a forum, just add the API after the comment or topic INSERT query in the database.

a) Use - Basic API

$api_AUP = JPATH_SITE.DS.'components'.DS.'com_alphauserpoints'.DS.'helper.php';
if ( file_exists($api_AUP))
{
require_once ($api_AUP);
AlphaUserPointsHelper::newpoints( 'function_name' );
}

function_name is the name of the rule that will be used to attribute points to the current user (if logged in). For each AlphaUserPoints integrated rule (system rules), names syntax is as follows:

example: sysplgaup_newregistered for new users points attribution

It is convinient to keep the same name syntax for third party components plugin as follows:

plgaup_functionname

Example: plgaup_newcomment or plgaup_newtopic for a comment system or forum API integration. To name a rule that would give points when adding a new topic in Fireboard: plgaup_newtopic_fb.

Keep in mind that this method only gives points to the current user. This is the Basic API.

b) Attribute points to another user:

To give points to anothe user than the one connected, only the user id is required. To get his AlphaUserPoints (AUPID) Identity, we just need to use the getAnyUserReferreID(). This method is the one used to give points to an article author when the article is being read by someone on the site.

$api_AUP = JPATH_SITE.DS.'components'.DS.'com_alphauserpoints'.DS.'helper.php';
if ( file_exists($api_AUP))
{
require_once ($api_AUP);

$aupid = AlphaUserPointsHelper::getAnyUserReferreID( $userID );

if ( $aupid ) AlphaUserPointsHelper::newpoints( 'function_name', $aupid );
}

c) Prevent from attributing points more than once for the same action:

To avoid that a user would get points many times for something allready done, we can add a reference key. When calling the AlphaUserPointsHelper::newpoints function, a pre check is done on this reference key. This method is used in the rule where a user reading an article would give points to the author.

$api_AUP = JPATH_SITE.DS.'components'.DS.'com_alphauserpoints'.DS.'helper.php';
if ( file_exists($api_AUP))
{
require_once ($api_AUP);
AlphaUserPointsHelper::newpoints( 'function_name', '', 'reference_key');
}

d) Adding information datas:

To add information datas to be displayed in the action details, just add a new parameter as follows:

$api_AUP = JPATH_SITE.DS.'components'.DS.'com_alphauserpoints'.DS.'helper.php';
if ( file_exists($api_AUP))
{
require_once ($api_AUP);
AlphaUserPointsHelper::newpoints( 'function_name', '', '', 'information_datas');
}

e) Using different amounts of points on the same rule:

A component might also need to add or to take points for different amounts. For example, when buying goods with points. Products have diferent prices, a fixed amount in the rule would'nt make it. The API $randompoints parameter comes instead of the amount of points set in the rule. It can be negative in case of purchases or penalities.

$api_AUP = JPATH_SITE.DS.'components'.DS.'com_alphauserpoints'.DS.'helper.php';
if ( file_exists($api_AUP))
{
require_once ($api_AUP);
AlphaUserPointsHelper::newpoints( 'function_name', '', '', '', -1450);
}

f) Get the result from a successfull operation:

In a more advanced code, if the component routine needs to know if the operation has been successfull or not, (enough amount of points for a purchase in a user account), we can add a 'feedback' parameter. It has a Boolean type value.

Code example:

$api_AUP = JPATH_SITE.DS.'components'.DS.'com_alphauserpoints'.DS.'helper.php';
if ( file_exists($api_AUP))
{
require_once ($api_AUP);
if (AlphaUserPointsHelper::newpoints( 'plgaup_purchasewithvirtuemart', '', 'payment ID: 20080831-YHMU', 'Product reference: AM-5245', -1290, true))
{
[... code continued ...]
}
}

g) API full implementation:

AlphaUserPointsHelper::newpoints( string$pluginfunction, [string$AUPIDotheruser = ''], [string$keyreference = ''], [string$data = ''], [integer$randompoints = 0], [boolean$feedback = false]);

Note: If a the operation is a points substraction, the account has to have at least the same amount of points. If not, a notice warns the user that he doe'snt have enough points to complete the action.



Step 2 - XML file creation
Then we have to create an xml file to make easier theinstallation process in the AlphaUserPoints component.
5 elements have to be filled in:

Rule name, its description, the name of the component using that rule (com_example), the used function name (eg: plgaup_vm_purchase) and the last parameter: fixed_points to specify if points are fixed or could change (boolean true or false). If set to false, attributed points for this rule would be zero and points have to be set by the api code parameter included in the third party compnent (as stated in this documentation).



Short name rule
Rule description
com_example
plgaup_function_name
true or false


This xml file has to be utf-8 encoded (required) and can then be zipped (not required)

Plugin installation

Install the new rule (plugin) using the Plugins button in the AlphaUserPoints component administration panel or from the menu: Components -> AlphaUserPoints -> Plugins. The plugin installation can also be completed from the 'New' menu item in AlphaUserPoints 'Rule manager'.
Rumuz: singlesoul
Kıdemsiz Üyemiz
Durum: Offline
Kullanıcı avatarı

İleti: 50
Kayıt: 04 Kas 2008

Re: alphauserpoint için şiirler plugini veya rule istiyoruz

İleti singlesoul » 29 Arl 2008

yukarıda yazılı api ile başlayan kodu düzenleyerek hangi dosya içine koymam gerekiyor ki rule çalışsın
Rumuz: singlesoul
Kıdemsiz Üyemiz
Durum: Offline
Kullanıcı avatarı

İleti: 50
Kayıt: 04 Kas 2008

Re: alphauserpoint için şiirler plugini veya rule istiyoruz

İleti Hasan » 30 Arl 2008

Bunu incelemek lazım böyle pat diye olmaz sanırım. Çok fazla vaktim olmuyo o yüzden kodlama kısmına derinden giremiyorum. Ara ara yazarlar modülünü 1.5'e uyumlu hale getirmek içinde uğraşıyorum. En kısa zamanda inşallah bununda üstesinden geliriz ama lütfen ben unutursam hatırlatın.
Quality Joomla! Projects Team
Rumuz: Hasan
GeliÅŸtirici
Durum: Offline
Kullanıcı avatarı

İleti: 1250
Kayıt: 05 Eyl 2007

Re: alphauserpoint için şiirler plugini veya rule istiyoruz

İleti singlesoul » 30 Arl 2008

hasan galiba hallettim yarın burada yayınlarım şu anda çalışıyor. tüm görevleri tamamlayıp dosyalarını burada yayınlarım
Rumuz: singlesoul
Kıdemsiz Üyemiz
Durum: Offline
Kullanıcı avatarı

İleti: 50
Kayıt: 04 Kas 2008

Re: alphauserpoint için şiirler plugini veya rule istiyoruz

İleti Hasan » 30 Arl 2008

Peki tamam.
Quality Joomla! Projects Team
Rumuz: Hasan
GeliÅŸtirici
Durum: Offline
Kullanıcı avatarı

İleti: 1250
Kayıt: 05 Eyl 2007


Sorularınız/Sorunlarınız

Yapimci phpBB © 2009 phpBB Group Style Tasarim Q-Proje