Magento:根据会话变量隐藏自定义模块块

时间:2015-12-08 08:30:07

标签: magento

我有自定义模块。在那里我创建了我的块类型。像这样:

class My_Module_Block_Subscribe extends Mage_Core_Block_Template {
    ...
}

如何根据会话变量显示/隐藏此块?

1 个答案:

答案 0 :(得分:2)

以下是我提出的答案

    Sub PASSWORD_CHECK()
    Dim wb As Workbook
    Dim ws As Worksheet

    Set wb = ThisWorkbook
    Set ws = wb.Sheets("Sheet1") ' Change the name of the sheet which is locked
    ws.Unprotect Password:="YourPassWord" ' Type your password

    Application.Worksheets("Front sheet").Range("B24").Formula = ("=VLOOKUP(D4,Lock!R:T,1,FALSE)")     ' looks up school name
    Application.Worksheets("Front sheet").Range("B25").Formula = ("=EXACT(B24, D4)")                   ' validation of school name
    Application.Worksheets("Front sheet").Range("B26").Formula = ("=VLOOKUP(D4,Lock!R3:T106,3,FALSE)") ' looks up password
    Application.Worksheets("Front sheet").Range("B27").Formula = ("=EXACT(B26,D6)")                    ' validates password
    Application.Worksheets("Front sheet").Range("B29").Formula = ("=IF(AND(B25,B27),1,0)")             ' checks to validate both school and pasword
    Application.Worksheets("Front sheet").Range("B32").Formula = ("=IF(B27=B25,1,0)") ' Checks to see if password belongs to school


     Dim A As String
     Dim B As String
     Dim C As Boolean
     Dim D As String
     Dim E As String
     Dim F As Boolean

        A = Worksheets("Staff Salaries").Range("P3")
        B = Worksheets("Staff Salaries").Range("N2")
        C = Worksheets("Front sheet").Range("B29")
        D = Worksheets("Front sheet").Range("D4")
        E = Worksheets("Front sheet").Range("D6")
        F = Worksheets("Front sheet").Range("B32")

     If C = "TRUE" And F = "TRUE" Then                   ' All OK

            Worksheets("Staff Salaries").Range("N2") = D
            Worksheets("Staff Salaries").Range("P3") = E
        Else
                           MsgBox ("PASSWORD IS INCONSISTANT WITH USER")
    End If

   ws.Protect Password:="YourPassWord"  

    End Sub