Thursday, January 24, 2013

ProcessMaker plugins with Smarty render


Here the code for controller /opt/plugins/my_first_plugin/my_first_plugin/services/render.smarty.php
<?php

/**
 * Render
 */
session_start();
//error_reporting(E_ALL);
//ini_set("display_errors", 1);
$G_MAIN_MENU        = "processmaker";
$G_ID_MENU_SELECTED = "ID_MY_FIRST_PLUGIN_MNU_01";

G::loadClass("pmFunctions");

$sQuery = "SELECT * FROM PMT_MY_DATA";
$aResp = executeQuery($sSQL);

$G_PUBLISH = new Publisher;
$aVars = array();
$aVars["PAGETITLE"] = "SAMPLE PAGE";
$aVars["PROJECTS"] = $aResp;

$G_PUBLISH->AddContent('smarty', 'my_first_plugin/render.smarty.html', '', '', $aVars);
G::RenderPage('publish', 'blank');
?>


And the code for the view /opt/plugins/my_first_plugin/my_first_plugin/render.smarty.html

<!-- template smarty -->


<html>
{literal}
<head>
<style type="text/css">
body{
    margin: 0px;
    padding: 0px;
    color: #000000;
    font-family: Arial, Helvetica, sans-serif;
}
#ftitle {font-family: Century Gothic, sans-serif; text-decoration: underline;}
#btable-b { font-family: "Lucida Sans Unicode","Lucida Grande",Sans-Serif; font-size: 12px; width: 700px; text-align: center; border-collapse: collapse; border-top: 4px solid #8E8E8E; border-bottom: 4px solid #8E8E8E; margin: 20px; }
#btable-b th {
    font-size: 13px; font-weight: normal; border-right: 1px solid #8E8E8E; border-left: 1px solid #8E8E8E; color: #000; padding: 8px;
    background: #fcfff4; background: -moz-linear-gradient(top,  #fcfff4 0%, #bcbcbc 100%); background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#fcfff4), color-stop(100%,#bcbcbc)); background: -webkit-linear-gradient(top,  #fcfff4 0%,#bcbcbc 100%); background: -o-linear-gradient(top,  #fcfff4 0%,#bcbcbc 100%); background: -ms-linear-gradient(top,  #fcfff4 0%,#bcbcbc 100%); background: linear-gradient(to bottom,  #fcfff4 0%,#bcbcbc 100%); filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fcfff4', endColorstr='#bcbcbc',GradientType=0 );
}
#btable-b td { background: none repeat scroll 0% 0% #fff; border-right: 1px solid #8E8E8E; border-left: 1px solid #8E8E8E; color: #474747; padding: 8px; }
#btable-b tr:hover td {background: none repeat scroll 0 0 #E8F3FF; color: #000000;}
</style>
</head>
{/literal}

<body>
<table cellspacing="0" cellpading="0" border="0" id="form-title">
<tr><th colspan="80">{$PAGETITLE}</th></tr>
</table>

<table cellspacing="0" cellpading="0" border="1" id="btable-b">
<tr>
<th align="right">#</th><th colspan="2" align="center">DETAIL</th><th align="center">STATUS</th>
</tr>
{foreach from=$RECORDS item=row}
<tr>
    <td width="10%" align="right">{counter}</td>
    <td width="70%" align="left">
        {$row.DETAIL_FIELD}
        <a href="../../my_first_plugin/services/view.php">
            <font color="blue">View</font>
        </a>
    </td>
    <td width="20%" align="left">
        {if $row.STATUS_FIELD neq "INACTIVE"}
            <font color="blue">{$row.STATUS_FIELD}</font>
        {else}
            <font color="red">OFF</font>
        {/if}
    </td>
</tr>
{/foreach}
</table>

</body>
</html>


You try it with the follow URL:
http://localhost/sysworkflow/en/classic/my_first_plugin/services/render.smarty.php



Saturday, January 5, 2013

Main interface and sub menu based on core of ProcessMaker

Here a detailed description to generate a new and different main interface of a plugin using code of core.


... asap ...

Wednesday, January 2, 2013

Default interface of plugin on ProcessMaker


The newest plugins generated with the command
# ./gulliver  new-plugin  my_first_plugin

Are plugins what uses interfaces generated with ExtJs Framework inside, that when you active the plugin then tab "my_first_plugin - application1" is activated on your main menu, if you click on this option show it:


The interface is blank and without logo and without main menu  ...  :(