Esempio n. 1
0
/**
 * This function generates the HTML code for the trailing button that allows the user to
 * perform custom actions for a given user.
 */
function actionButtonToCustomer($customer, $customer_type, $db)
{
    // Language Handler
    $lh = \creamy\LanguageHandler::getInstance();
    // Module Handler
    $mh = \creamy\ModuleHandler::getInstance();
    // UI Handler
    $ui = \creamy\UIHandler::getInstance();
    // Build basic button options: modify, delete.
    $modifyLink = "editcustomer.php?customerid=" . $customer["id"] . "&customer_type={$customer_type}";
    $modifyOption = $ui->actionForPopupButtonWithLink($modifyLink, $lh->translationFor("modify"));
    $deleteOption = $ui->actionForPopupButtonWithOnClickCode($lh->translationFor("delete"), "deleteCustomer", array($customer["id"], $customer_type));
    $eventOption = $ui->actionForPopupButtonWithOnClickCode($lh->translationFor("create_reminder_event"), "createEventForCustomer", array($customer["id"], $customer_type));
    $separator = $ui->separatorForPopupButton();
    // change customer type. One for every customer type except current one.
    $typeOptions = "";
    $customerTypes = $db->getCustomerTypes();
    foreach ($customerTypes as $otherCustomerType) {
        if ($otherCustomerType["table_name"] != $customer_type) {
            // add a change to... button.
            $changeTypeText = $lh->translationFor("move_to") . " " . $otherCustomerType["description"];
            $typeOptions .= $ui->actionForPopupButtonWithOnClickCode($changeTypeText, "changeCustomerType", array($customer["id"], $customer_type, $otherCustomerType["table_name"]));
        }
    }
    // add any module action.
    $args = array(CRM_MODULE_HOOK_PARAMETER_CUSTOMER_LIST_ID => $customer["id"], CRM_MODULE_HOOK_PARAMETER_CUSTOMER_LIST_NAME => $customer["name"], CRM_MODULE_HOOK_PARAMETER_CUSTOMER_LIST_TYPE => $customer_type);
    $moduleActions = $mh->applyHookOnActiveModules(CRM_MODULE_HOOK_CUSTOMER_LIST_POPUP, $args, CRM_MODULE_MERGING_STRATEGY_APPEND);
    // build the pop up action button and return it.
    $result = $ui->popupActionButton($lh->translationFor("choose_action"), array($modifyOption, $moduleActions, $eventOption, $separator, $typeOptions, $separator, $deleteOption), array("default"));
    return $result;
}
Esempio n. 2
0
	
	THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
	IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
	FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
	AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
	LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
	OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
	THE SOFTWARE.
*/
require_once './php/CRMDefaults.php';
require_once './php/UIHandler.php';
require_once './php/LanguageHandler.php';
require_once './php/DbHandler.php';
require_once './php/CRMUtils.php';
include './php/Session.php';
$ui = \creamy\UIHandler::getInstance();
$lh = \creamy\LanguageHandler::getInstance();
$db = new \creamy\DbHandler();
$user = \creamy\CreamyUser::currentUser();
// get parameters
if (isset($_GET["folder"])) {
    $folder = $_GET["folder"];
} else {
    $folder = MESSAGES_GET_INBOX_MESSAGES;
}
if ($folder < 0 || $folder > MESSAGES_MAX_FOLDER) {
    $folder = MESSAGES_GET_INBOX_MESSAGES;
}
if (isset($_GET["message_id"])) {
    $messageid = $_GET["message_id"];
} else {
Esempio n. 3
0
 /**
  * Convenience method that returns the Language handler associated with the module. If it has not been
  * created before, a new instance is created and returned.
  * @return an instance of LanguageHandler.
  */
 public function ui()
 {
     if (!isset($this->uiHandler)) {
         $this->uiHandler = \creamy\UIHandler::getInstance();
     }
     return $this->uiHandler;
 }