-
About the System
-
Managing Users
-
Access permissions
-
Using system tools
-
AD/LDAP
-
Blogs
-
Business Processes
-
Business Process Designer
-
Visual Modeler
-
Business Process Templates
-
Actions
-
Document Processing
-
Constructions
-
Notifications
-
Other
-
My Actions
-
CRM
-
Activity
-
Create new company
-
Create new contact
-
Create CRM event
-
Create new lead
-
Create new deal
-
Create using source
-
Change responsible person
-
Change status
-
Waiting for deal status
-
Waiting for lead status
-
Send SMS
-
Send email
-
Schedule a call
-
Schedule a meeting
-
Get CRM data
-
Facebook Advertisements
-
Google AdWords Advertisements
-
Add to exceptions
-
Add comment
-
Book a resource
-
Cancel booking
-
Wait
-
Create CRM document
-
Create contact or lead
-
Create repeat lead
-
-
-
-
Common Lists
-
Currencies
-
Document Library
-
e-Learning
-
Basic notions
-
Creating lessons and tests
-
Publishing a training course
-
-
Extranet
-
Forum
-
Helpdesk
-
Setting up your helpedesk service
-
Dictionaries
-
SLA
-
How to assign the ticket duty
-
Submitting tickets to tech support via e-mail
-
Functions available in the public section
-
Administration interface
-
-
Information Blocks
-
Basic notions
-
Typical Operations
-
Extra features
-
-
Intranet
-
Mail
-
Performance Monitor
-
Photo Gallery
-
Polls and surveys
-
Proactive Protection
-
Push and Pull
-
Push & Pull scope of application
-
Push server operational basis
-
Queue server versions
-
Configuring P&P module and queue server
-
Upgrade from Bitrix Push server 1.0 to Bitrix Push server 2.0
-
Upgrade from Nginx-PushStreamModule to Bitrix Push server 2.0
-
Using separate queue server
-
Push server setup and start at the 3rd-party environment
-
-
Scalability
-
Scalability Panel
-
Load chart
-
VPS Orders
-
-
Search
-
Main Concepts
-
Site indexing
-
Morphological search
-
Ranking Rules
-
Logical operators
-
Document Search Setup
-
Adding new formats
-
Setting Up Web Environment with PHP Version below 5.2.6
-
Search of MS Office documents of earlier versions
-
-
Sphinx search set up
-
-
Social Network
-
Technical Support
-
Telephony
-
Web forms
-
XMPP Server
-
Multiple Divisions
-
External data import to Activity Stream
PHP Code
Lesson 80 out of 279
This action permits you to execute an arbitrary [dw]PHP code.[/dw][di]Attention! Only a user with administrator’s access permissions can set PHP code[/di]
Action Parameters
Since the meaning of most fields is clear from their names, their description is omitted.
Examples of application
<?
, ?>
).{=...}
in the code boy. They can contain parameters that can be modified by any user of bitrix24 account without necessary access permissions.
For example, instead of structure
{=Variable:COMPANY_NAME}
use code>$root->GetVariable('COMPANY_NAME').Setting a value for the variable
$this->SetVariable('Variable1', 12345);
where:
Variable1 – identifier of the variable to which a value will be assigned (12345 number).Entering several users to the User type variable
$this->SetVariable("user", array("user_1", "user_2"));
where:
array("user_1", "user_2") – an array of users in the formatuser_[user_identifier_in_the_system]
.
The use of PHP code and values of fields/variables to obtain the name of the infoblock element
$arFilter = Array("IBLOCK_ID" => {=Variable:Variable1_printable}, "ID" => {=Document:PROPERTY_1}); $dc = CIBlockElement::GetList(array(), $arFilter, array("NAME")); $br = $dc->Fetch(); $Pbrr = $br["NAME"]; $this -> SetVariable('Variable2', $Pbrr);
where:
{=Variable:Variable1_printable} – value of the variable containing the infoblock identifier;{=Document:PROPERTY_1} – field of the document containing the infoblock element identifier;
Variable2 – identifier of the variable which will be assigned the calculated name of the infoblock element.
Conversion of the document field format and its further use
Let us consider an example of conversion of the document field User to an understandable form in order to use it when sending a message:
- A variable to store the converted value of the document field should be created in the business process template;
- Let us indicate the following in the PHP code action:
$rsUser = CUser::GetByID({=Document:PROPERTY_USER}); $arUser = $rsUser->Fetch(); $this->SetVariable('#Variable_name#', $arUser[NAME].' '.$arUser[SECOND_NAME].' '.$arUser[LAST_NAME]);
- After that, we have to use the result of this variable instead of the document field in the block used for notification.